Commit e8e83f3c authored by David Roger's avatar David Roger Committed by Commit Bot

[signin] Remove unused prefs::kGoogleServicesUserAccountId

This pref was only read in one place (chrome_content_browser_client),
to check if the user is signed in.

TBR=jzw

Change-Id: I491b06b5fefd9fef5d7dc27a38a652870c1a5cc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795330
Commit-Queue: David Roger <droger@chromium.org>
Reviewed-by: default avatarMonica Basta <msalama@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695988}
parent ae4a505c
...@@ -131,6 +131,7 @@ ...@@ -131,6 +131,7 @@
#include "chrome/browser/signin/chrome_signin_proxying_url_loader_factory.h" #include "chrome/browser/signin/chrome_signin_proxying_url_loader_factory.h"
#include "chrome/browser/signin/chrome_signin_url_loader_throttle.h" #include "chrome/browser/signin/chrome_signin_url_loader_throttle.h"
#include "chrome/browser/signin/header_modification_delegate_on_ui_thread_impl.h" #include "chrome/browser/signin/header_modification_delegate_on_ui_thread_impl.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/site_isolation/site_isolation_policy.h" #include "chrome/browser/site_isolation/site_isolation_policy.h"
#include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
#include "chrome/browser/speech/tts_controller_delegate_impl.h" #include "chrome/browser/speech/tts_controller_delegate_impl.h"
...@@ -251,7 +252,7 @@ ...@@ -251,7 +252,7 @@
#include "components/safe_browsing/features.h" #include "components/safe_browsing/features.h"
#include "components/safe_browsing/password_protection/password_protection_navigation_throttle.h" #include "components/safe_browsing/password_protection/password_protection_navigation_throttle.h"
#include "components/security_interstitials/content/origin_policy_ui.h" #include "components/security_interstitials/content/origin_policy_ui.h"
#include "components/signin/public/base/signin_pref_names.h" #include "components/signin/public/identity_manager/identity_manager.h"
#include "components/spellcheck/spellcheck_buildflags.h" #include "components/spellcheck/spellcheck_buildflags.h"
#include "components/startup_metric_utils/browser/startup_metric_host_impl.h" #include "components/startup_metric_utils/browser/startup_metric_host_impl.h"
#include "components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h" #include "components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h"
...@@ -4592,11 +4593,9 @@ ChromeContentBrowserClient::CreateURLLoaderThrottles( ...@@ -4592,11 +4593,9 @@ ChromeContentBrowserClient::CreateURLLoaderThrottles(
base::CreateSingleThreadTaskRunner({BrowserThread::UI}))); base::CreateSingleThreadTaskRunner({BrowserThread::UI})));
} }
bool is_off_the_record = profile->IsOffTheRecord(); signin::IdentityManager* identity_manager =
bool is_signed_in = !is_off_the_record && IdentityManagerFactory::GetForProfile(profile);
!profile->GetPrefs() bool is_signed_in = identity_manager && identity_manager->HasPrimaryAccount();
->GetString(prefs::kGoogleServicesUserAccountId)
.empty();
chrome::mojom::DynamicParams dynamic_params = { chrome::mojom::DynamicParams dynamic_params = {
profile->GetPrefs()->GetBoolean(prefs::kForceGoogleSafeSearch), profile->GetPrefs()->GetBoolean(prefs::kForceGoogleSafeSearch),
...@@ -4605,7 +4604,7 @@ ChromeContentBrowserClient::CreateURLLoaderThrottles( ...@@ -4605,7 +4604,7 @@ ChromeContentBrowserClient::CreateURLLoaderThrottles(
variations::VariationsHttpHeaderProvider::GetInstance() variations::VariationsHttpHeaderProvider::GetInstance()
->GetClientDataHeader(is_signed_in)}; ->GetClientDataHeader(is_signed_in)};
result.push_back(std::make_unique<GoogleURLLoaderThrottle>( result.push_back(std::make_unique<GoogleURLLoaderThrottle>(
is_off_the_record, std::move(dynamic_params))); profile->IsOffTheRecord(), std::move(dynamic_params)));
result.push_back(std::make_unique<ProtocolHandlerThrottle>( result.push_back(std::make_unique<ProtocolHandlerThrottle>(
ProtocolHandlerRegistryFactory::GetForBrowserContext(browser_context))); ProtocolHandlerRegistryFactory::GetForBrowserContext(browser_context)));
......
...@@ -498,6 +498,7 @@ const char kHintLoadedCounts[] = "optimization_guide.hint_loaded_counts"; ...@@ -498,6 +498,7 @@ const char kHintLoadedCounts[] = "optimization_guide.hint_loaded_counts";
// Deprecated 9/2019 // Deprecated 9/2019
const char kGoogleServicesUsername[] = "google.services.username"; const char kGoogleServicesUsername[] = "google.services.username";
const char kGoogleServicesUserAccountId[] = "google.services.user_account_id";
// Register prefs used only for migration (clearing or moving to a new key). // Register prefs used only for migration (clearing or moving to a new key).
void RegisterProfilePrefsForMigration( void RegisterProfilePrefsForMigration(
...@@ -576,6 +577,7 @@ void RegisterProfilePrefsForMigration( ...@@ -576,6 +577,7 @@ void RegisterProfilePrefsForMigration(
registry->RegisterDictionaryPref(kHintLoadedCounts); registry->RegisterDictionaryPref(kHintLoadedCounts);
registry->RegisterStringPref(kGoogleServicesUsername, std::string()); registry->RegisterStringPref(kGoogleServicesUsername, std::string());
registry->RegisterStringPref(kGoogleServicesUserAccountId, std::string());
} }
} // namespace } // namespace
...@@ -1188,4 +1190,5 @@ void MigrateObsoleteProfilePrefs(Profile* profile) { ...@@ -1188,4 +1190,5 @@ void MigrateObsoleteProfilePrefs(Profile* profile) {
// Added 9/2019 // Added 9/2019
profile_prefs->ClearPref(kGoogleServicesUsername); profile_prefs->ClearPref(kGoogleServicesUsername);
profile_prefs->ClearPref(kGoogleServicesUserAccountId);
} }
...@@ -115,8 +115,8 @@ class MirrorBrowserTest : public InProcessBrowserTest { ...@@ -115,8 +115,8 @@ class MirrorBrowserTest : public InProcessBrowserTest {
// and not because it was on a secure Google domain. // and not because it was on a secure Google domain.
// This is a regression test for crbug.com/588492. // This is a regression test for crbug.com/588492.
IN_PROC_BROWSER_TEST_F(MirrorBrowserTest, MirrorRequestHeader) { IN_PROC_BROWSER_TEST_F(MirrorBrowserTest, MirrorRequestHeader) {
browser()->profile()->GetPrefs()->SetString( browser()->profile()->GetPrefs()->SetString(prefs::kGoogleServicesAccountId,
prefs::kGoogleServicesUserAccountId, "account_id"); "account_id");
base::Lock lock; base::Lock lock;
// Map from the path of the URLs that test server sees to the request header. // Map from the path of the URLs that test server sees to the request header.
......
...@@ -53,8 +53,6 @@ void PrimaryAccountManager::RegisterProfilePrefs(PrefRegistrySimple* registry) { ...@@ -53,8 +53,6 @@ void PrimaryAccountManager::RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterStringPref(prefs::kGoogleServicesLastUsername, registry->RegisterStringPref(prefs::kGoogleServicesLastUsername,
std::string()); std::string());
registry->RegisterStringPref(prefs::kGoogleServicesAccountId, std::string()); registry->RegisterStringPref(prefs::kGoogleServicesAccountId, std::string());
registry->RegisterStringPref(prefs::kGoogleServicesUserAccountId,
std::string());
registry->RegisterBooleanPref(prefs::kAutologinEnabled, true); registry->RegisterBooleanPref(prefs::kAutologinEnabled, true);
registry->RegisterListPref(prefs::kReverseAutologinRejectedEmailList); registry->RegisterListPref(prefs::kReverseAutologinRejectedEmailList);
registry->RegisterBooleanPref(prefs::kSigninAllowed, true); registry->RegisterBooleanPref(prefs::kSigninAllowed, true);
...@@ -78,7 +76,6 @@ void PrimaryAccountManager::Initialize(PrefService* local_state) { ...@@ -78,7 +76,6 @@ void PrimaryAccountManager::Initialize(PrefService* local_state) {
base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
if (cmd_line->HasSwitch(switches::kClearTokenService)) { if (cmd_line->HasSwitch(switches::kClearTokenService)) {
client_->GetPrefs()->ClearPref(prefs::kGoogleServicesAccountId); client_->GetPrefs()->ClearPref(prefs::kGoogleServicesAccountId);
client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUserAccountId);
} }
std::string pref_account_id = std::string pref_account_id =
...@@ -144,13 +141,6 @@ void PrimaryAccountManager::SetAuthenticatedAccountInfo( ...@@ -144,13 +141,6 @@ void PrimaryAccountManager::SetAuthenticatedAccountInfo(
client_->GetPrefs()->SetString(prefs::kGoogleServicesAccountId, client_->GetPrefs()->SetString(prefs::kGoogleServicesAccountId,
account_info.account_id.id); account_info.account_id.id);
// When this function is called from Initialize(), it's possible for
// |info.gaia| to be empty when migrating from a really old profile.
if (!account_info.gaia.empty()) {
client_->GetPrefs()->SetString(prefs::kGoogleServicesUserAccountId,
account_info.gaia);
}
// Go ahead and update the last signed in account info here as well. Once a // Go ahead and update the last signed in account info here as well. Once a
// user is signed in the corresponding preferences should match. Doing it here // user is signed in the corresponding preferences should match. Doing it here
// as opposed to on signin allows us to catch the upgrade scenario. // as opposed to on signin allows us to catch the upgrade scenario.
...@@ -295,7 +285,6 @@ void PrimaryAccountManager::OnSignoutDecisionReached( ...@@ -295,7 +285,6 @@ void PrimaryAccountManager::OnSignoutDecisionReached(
ClearAuthenticatedAccountInfo(); ClearAuthenticatedAccountInfo();
client_->GetPrefs()->ClearPref(prefs::kGoogleServicesHostedDomain); client_->GetPrefs()->ClearPref(prefs::kGoogleServicesHostedDomain);
client_->GetPrefs()->ClearPref(prefs::kGoogleServicesAccountId); client_->GetPrefs()->ClearPref(prefs::kGoogleServicesAccountId);
client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUserAccountId);
// Revoke all tokens before sending signed_out notification, because there // Revoke all tokens before sending signed_out notification, because there
// may be components that don't listen for token service events when the // may be components that don't listen for token service events when the
......
...@@ -41,10 +41,9 @@ const char kGaiaCookieChangedTime[] = "gaia_cookie.changed_time"; ...@@ -41,10 +41,9 @@ const char kGaiaCookieChangedTime[] = "gaia_cookie.changed_time";
// double that should be converted into base::Time. // double that should be converted into base::Time.
const char kGaiaCookiePeriodicReportTime[] = "gaia_cookie.periodic_report_time"; const char kGaiaCookiePeriodicReportTime[] = "gaia_cookie.periodic_report_time";
// Typically contains an obfuscated gaiaid and will match the value of // Typically contains an obfuscated gaiaid. Some platforms may have
// kGoogleServicesUserAccountId. Some platforms and legacy clients may have
// an email stored in this preference instead. This is transitional and will // an email stored in this preference instead. This is transitional and will
// eventually be fixed, allowing the removal of kGoogleServicesUserAccountId. // eventually be fixed.
const char kGoogleServicesAccountId[] = "google.services.account_id"; const char kGoogleServicesAccountId[] = "google.services.account_id";
// The profile's hosted domain; empty if unset; kNoHostedDomainFound if there // The profile's hosted domain; empty if unset; kNoHostedDomainFound if there
...@@ -68,10 +67,6 @@ const char kGoogleServicesLastUsername[] = "google.services.last_username"; ...@@ -68,10 +67,6 @@ const char kGoogleServicesLastUsername[] = "google.services.last_username";
const char kGoogleServicesSigninScopedDeviceId[] = const char kGoogleServicesSigninScopedDeviceId[] =
"google.services.signin_scoped_device_id"; "google.services.signin_scoped_device_id";
// Obfuscated account ID that identifies the current user logged into sync and
// other google services.
const char kGoogleServicesUserAccountId[] = "google.services.user_account_id";
// Local state pref containing a string regex that restricts which accounts // Local state pref containing a string regex that restricts which accounts
// can be used to log in to chrome (e.g. "*@google.com"). If missing or blank, // can be used to log in to chrome (e.g. "*@google.com"). If missing or blank,
// all accounts are allowed (no restrictions). // all accounts are allowed (no restrictions).
......
...@@ -21,7 +21,6 @@ extern const char kGoogleServicesHostedDomain[]; ...@@ -21,7 +21,6 @@ extern const char kGoogleServicesHostedDomain[];
extern const char kGoogleServicesLastAccountId[]; extern const char kGoogleServicesLastAccountId[];
extern const char kGoogleServicesLastUsername[]; extern const char kGoogleServicesLastUsername[];
extern const char kGoogleServicesSigninScopedDeviceId[]; extern const char kGoogleServicesSigninScopedDeviceId[];
extern const char kGoogleServicesUserAccountId[];
extern const char kGoogleServicesUsernamePattern[]; extern const char kGoogleServicesUsernamePattern[];
extern const char kReverseAutologinRejectedEmailList[]; extern const char kReverseAutologinRejectedEmailList[];
extern const char kSignedInWithCredentialProvider[]; extern const char kSignedInWithCredentialProvider[];
......
...@@ -96,10 +96,6 @@ class ChromeBrowserStateIOData { ...@@ -96,10 +96,6 @@ class ChromeBrowserStateIOData {
content_settings::CookieSettings* GetCookieSettings() const; content_settings::CookieSettings* GetCookieSettings() const;
HostContentSettingsMap* GetHostContentSettingsMap() const; HostContentSettingsMap* GetHostContentSettingsMap() const;
StringPrefMember* google_services_account_id() const {
return &google_services_user_account_id_;
}
net::TransportSecurityState* transport_security_state() const { net::TransportSecurityState* transport_security_state() const {
return transport_security_state_.get(); return transport_security_state_.get();
} }
...@@ -259,8 +255,6 @@ class ChromeBrowserStateIOData { ...@@ -259,8 +255,6 @@ class ChromeBrowserStateIOData {
// ChromeBrowserStateIOData. Deleted after lazy initialization. // ChromeBrowserStateIOData. Deleted after lazy initialization.
mutable std::unique_ptr<ProfileParams> profile_params_; mutable std::unique_ptr<ProfileParams> profile_params_;
mutable StringPrefMember google_services_user_account_id_;
// Member variables which are pointed to by the various context objects. // Member variables which are pointed to by the various context objects.
mutable BooleanPrefMember enable_referrers_; mutable BooleanPrefMember enable_referrers_;
mutable BooleanPrefMember enable_do_not_track_; mutable BooleanPrefMember enable_do_not_track_;
......
...@@ -113,14 +113,6 @@ void ChromeBrowserStateIOData::InitializeOnUIThread( ...@@ -113,14 +113,6 @@ void ChromeBrowserStateIOData::InitializeOnUIThread(
chrome_http_user_agent_settings_.reset( chrome_http_user_agent_settings_.reset(
new IOSChromeHttpUserAgentSettings(pref_service)); new IOSChromeHttpUserAgentSettings(pref_service));
// These members are used only for sign in, which is not enabled
// in incognito mode. So no need to initialize them.
if (!IsOffTheRecord()) {
google_services_user_account_id_.Init(prefs::kGoogleServicesUserAccountId,
pref_service);
google_services_user_account_id_.MoveToSequence(io_task_runner);
}
} }
ChromeBrowserStateIOData::AppRequestContext::AppRequestContext() {} ChromeBrowserStateIOData::AppRequestContext::AppRequestContext() {}
...@@ -412,7 +404,6 @@ void ChromeBrowserStateIOData::ShutdownOnUIThread( ...@@ -412,7 +404,6 @@ void ChromeBrowserStateIOData::ShutdownOnUIThread(
std::unique_ptr<IOSChromeURLRequestContextGetterVector> context_getters) { std::unique_ptr<IOSChromeURLRequestContextGetterVector> context_getters) {
DCHECK_CURRENTLY_ON(web::WebThread::UI); DCHECK_CURRENTLY_ON(web::WebThread::UI);
google_services_user_account_id_.Destroy();
enable_referrers_.Destroy(); enable_referrers_.Destroy();
enable_do_not_track_.Destroy(); enable_do_not_track_.Destroy();
enable_metrics_.Destroy(); enable_metrics_.Destroy();
......
...@@ -74,6 +74,7 @@ const char kLastPromptedGoogleURL[] = "browser.last_prompted_google_url"; ...@@ -74,6 +74,7 @@ const char kLastPromptedGoogleURL[] = "browser.last_prompted_google_url";
// Deprecated 9/2019 // Deprecated 9/2019
const char kGoogleServicesUsername[] = "google.services.username"; const char kGoogleServicesUsername[] = "google.services.username";
const char kGoogleServicesUserAccountId[] = "google.services.user_account_id";
} }
void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {
...@@ -184,6 +185,7 @@ void RegisterBrowserStatePrefs(user_prefs::PrefRegistrySyncable* registry) { ...@@ -184,6 +185,7 @@ void RegisterBrowserStatePrefs(user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterStringPref(kLastKnownGoogleURL, std::string()); registry->RegisterStringPref(kLastKnownGoogleURL, std::string());
registry->RegisterStringPref(kLastPromptedGoogleURL, std::string()); registry->RegisterStringPref(kLastPromptedGoogleURL, std::string());
registry->RegisterStringPref(kGoogleServicesUsername, std::string()); registry->RegisterStringPref(kGoogleServicesUsername, std::string());
registry->RegisterStringPref(kGoogleServicesUserAccountId, std::string());
} }
// This method should be periodically pruned of year+ old migrations. // This method should be periodically pruned of year+ old migrations.
...@@ -215,4 +217,5 @@ void MigrateObsoleteBrowserStatePrefs(PrefService* prefs) { ...@@ -215,4 +217,5 @@ void MigrateObsoleteBrowserStatePrefs(PrefService* prefs) {
// Added 09/2019 // Added 09/2019
prefs->ClearPref(kGoogleServicesUsername); prefs->ClearPref(kGoogleServicesUsername);
prefs->ClearPref(kGoogleServicesUserAccountId);
} }
...@@ -65,7 +65,6 @@ WebViewIdentityManagerFactory::BuildServiceInstanceFor( ...@@ -65,7 +65,6 @@ WebViewIdentityManagerFactory::BuildServiceInstanceFor(
// ChromeWebView's signin state. // ChromeWebView's signin state.
PrefService* pref_service = browser_state->GetPrefs(); PrefService* pref_service = browser_state->GetPrefs();
pref_service->ClearPref(prefs::kGoogleServicesAccountId); pref_service->ClearPref(prefs::kGoogleServicesAccountId);
pref_service->ClearPref(prefs::kGoogleServicesUserAccountId);
IOSWebViewSigninClient* client = IOSWebViewSigninClient* client =
WebViewSigninClientFactory::GetForBrowserState(browser_state); WebViewSigninClientFactory::GetForBrowserState(browser_state);
......
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