Commit 4fe42077 authored by Colin Blundell's avatar Colin Blundell Committed by Commit Bot

Fixup of how AutofillClient impls get IdentityManager after r537790

https://chromium-review.googlesource.com/904992 added a new
AutofillClient::GetIdentityManager() interface. That CL mistakenly
had the ChromeAutofillClient and ChromeAutofillClientIOS implementations
return the IdentityManager instance associated with the current Profile.
It should actually be the IdentityManager instance associated with the
*original Profile* (/ChromeBrowserState) to be parallel with those
clients' constructions of the ProfileIdentityProvider instances whose
usage IdentityManager is replacing in //components/autofill.

Note that I verified that these are the only client implementations that
need this fix:

- AWAutofillClient returns nullptr for both the IdentityProvider and the
IdentityManager.
- WebViewAutofillClient (in //ios) doesn't use the original
  ChromeBrowserState for anything, I assume because it doesn't have
  incognito.

This bug was uncovered by the UBSanVptr bot. Thanks, UBSanVptr bot!

Bug: 798413, 814308
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I3e87888bc622204a29b4f9d3990fa39e8b165eb3
Reviewed-on: https://chromium-review.googlesource.com/928654Reviewed-by: default avatarMathieu Perreault <mathp@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539451}
parent 71e7fd17
......@@ -132,7 +132,8 @@ syncer::SyncService* ChromeAutofillClient::GetSyncService() {
identity::IdentityManager* ChromeAutofillClient::GetIdentityManager() {
Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
return IdentityManagerFactory::GetInstance()->GetForProfile(profile);
return IdentityManagerFactory::GetInstance()->GetForProfile(
profile->GetOriginalProfile());
}
IdentityProvider* ChromeAutofillClient::GetIdentityProvider() {
......
......@@ -49,7 +49,7 @@ ChromeAutofillClientIOS::ChromeAutofillClientIOS(
bridge_(bridge),
identity_manager_(
IdentityManagerFactory::GetInstance()->GetForBrowserState(
browser_state)),
browser_state->GetOriginalChromeBrowserState())),
identity_provider_(std::move(identity_provider)),
autofill_web_data_service_(
ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment