Commit 2d44c836 authored by James Cook's avatar James Cook Committed by Commit Bot

cros: Migrate fileManagerPrivate API to unconsented primary account

SplitSettingsSync will allow the user to opt-out of browser sync.
However, IdentityAccessor::GetPrimaryAccountInfo() assumes the user has
consented to browser sync. Google Drive isn't tied to browser sync
consent.

Switch to using the "unconsented" primary account. On Chrome OS this
account always exists for the logged-in user account, whether or not
the user consented to browser sync.

See go/cros-sync-mock and go/cros-primary-account for details.

Bug: 1042400
Test: logging shows access tokens still fetched
Change-Id: Ic5b95e0fe7484e373550fa93b87aa9b782aeae05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2036380Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737980}
parent b15f982a
...@@ -1040,7 +1040,9 @@ void FileManagerPrivateInternalGetDownloadUrlFunction::OnGotDownloadUrl( ...@@ -1040,7 +1040,9 @@ void FileManagerPrivateInternalGetDownloadUrlFunction::OnGotDownloadUrl(
const ChromeExtensionFunctionDetails chrome_details(this); const ChromeExtensionFunctionDetails chrome_details(this);
signin::IdentityManager* identity_manager = signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(chrome_details.GetProfile()); IdentityManagerFactory::GetForProfile(chrome_details.GetProfile());
const CoreAccountId& account_id = identity_manager->GetPrimaryAccountId(); // This class doesn't care about browser sync consent.
const CoreAccountId& account_id =
identity_manager->GetUnconsentedPrimaryAccountId();
std::vector<std::string> scopes; std::vector<std::string> scopes;
scopes.emplace_back("https://www.googleapis.com/auth/drive.readonly"); scopes.emplace_back("https://www.googleapis.com/auth/drive.readonly");
......
...@@ -376,8 +376,9 @@ FileManagerPrivateRequestWebStoreAccessTokenFunction::Run() { ...@@ -376,8 +376,9 @@ FileManagerPrivateRequestWebStoreAccessTokenFunction::Run() {
return RespondNow(Error("Unable to fetch token.")); return RespondNow(Error("Unable to fetch token."));
} }
// "Unconsented" because this class doesn't care about browser sync consent.
auth_service_ = std::make_unique<google_apis::AuthService>( auth_service_ = std::make_unique<google_apis::AuthService>(
identity_manager, identity_manager->GetPrimaryAccountId(), identity_manager, identity_manager->GetUnconsentedPrimaryAccountId(),
g_browser_process->system_network_context_manager() g_browser_process->system_network_context_manager()
->GetSharedURLLoaderFactory(), ->GetSharedURLLoaderFactory(),
scopes); scopes);
......
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