Preparation to convert GetPrimaryAccount to return CoreAccountInfo

Change client code to work as if IdentityManager::GetPrimaryAccount
where returning a CoreAccountInfo instead of an AccountInfo. Method
will be updated in a followup CL.

This CL was uploaded by git cl split.

Bug: 926204
Change-Id: Ib01a380d83bbfdc364b5d7ae9edc845769112684
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1499461
Reviewed-by: Evan Stade <estade@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642985}
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc
index 92b5786..0e32a8c 100644
--- a/chrome/browser/ui/autofill/chrome_autofill_client.cc
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -592,8 +592,12 @@
       IdentityManagerFactory::GetForProfile(profile);
   if (!identity_manager)
     return base::string16();
-  AccountInfo account_info = identity_manager->GetPrimaryAccountInfo();
-  return base::UTF8ToUTF16(account_info.full_name);
+  base::Optional<AccountInfo> primary_account_info =
+      identity_manager->FindExtendedAccountInfoForAccount(
+          identity_manager->GetPrimaryAccountInfo());
+  return primary_account_info
+             ? base::UTF8ToUTF16(primary_account_info->full_name)
+             : base::string16();
 }
 
 WEB_CONTENTS_USER_DATA_KEY_IMPL(ChromeAutofillClient)
diff --git a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc
index 947b9c0..ff9e36b 100644
--- a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc
+++ b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc
@@ -526,7 +526,10 @@
   auto* identity_manager = IdentityManagerFactory::GetForProfile(profile);
   if (!identity_manager)
     return;
-  account_info_ = identity_manager->GetPrimaryAccountInfo();
+  base::Optional<AccountInfo> primary_account_info =
+      identity_manager->FindExtendedAccountInfoForAccount(
+          identity_manager->GetPrimaryAccountInfo());
+  account_info_ = primary_account_info.value_or(AccountInfo{});
 }
 
 void SaveCardBubbleControllerImpl::ShowBubble() {