diff options
Diffstat (limited to 'chrome/browser/ui')
17 files changed, 55 insertions, 27 deletions
diff --git a/chrome/browser/ui/app_list/speech_auth_helper_unittest.cc b/chrome/browser/ui/app_list/speech_auth_helper_unittest.cc index 7302af1..902f9b5 100644 --- a/chrome/browser/ui/app_list/speech_auth_helper_unittest.cc +++ b/chrome/browser/ui/app_list/speech_auth_helper_unittest.cc @@ -25,6 +25,7 @@ namespace app_list { +static const char* kTestGaiaId = "gaia_id"; static const char* kTestUser = "test.user@chromium.org.test"; static const char* kScope = "https://www.googleapis.com/auth/webhistory"; static const char* kAccessToken = "fake_access_token"; @@ -53,8 +54,8 @@ class SpeechAuthHelperTest : public testing::Test { factories); // Set up the authenticated user name and ID. - SigninManagerFactory::GetForProfile(profile_)->SetAuthenticatedUsername( - kTestUser); + SigninManagerFactory::GetForProfile(profile_)->SetAuthenticatedAccountInfo( + kTestGaiaId, kTestUser); } protected: diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc index aa5e119..e1e566e 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc @@ -14,6 +14,7 @@ #include "base/time/time.h" #include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/account_tracker_service_factory.h" #include "chrome/browser/ui/autofill/account_chooser_model.h" #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h" @@ -43,6 +44,7 @@ #include "components/autofill/core/common/autofill_switches.h" #include "components/autofill/core/common/form_data.h" #include "components/autofill/core/common/form_field_data.h" +#include "components/signin/core/browser/account_tracker_service.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/interstitial_page.h" #include "content/public/browser/navigation_details.h" @@ -104,9 +106,12 @@ class TestAutofillDialogController : public AutofillDialogControllerImpl { use_validation_(false), sign_in_user_index_(0U), weak_ptr_factory_(this) { + Profile* profile = + Profile::FromBrowserContext(contents->GetBrowserContext()); test_manager_.Init( NULL, - Profile::FromBrowserContext(contents->GetBrowserContext())->GetPrefs(), + profile->GetPrefs(), + AccountTrackerServiceFactory::GetForProfile(profile), false); } diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc index 55b9a39..4b7e267 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc @@ -18,6 +18,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/signin/account_tracker_service_factory.h" #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h" #include "chrome/browser/ui/autofill/autofill_dialog_view.h" @@ -48,6 +49,7 @@ #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/autofill/core/common/autofill_switches.h" #include "components/autofill/core/common/form_data.h" +#include "components/signin/core/browser/account_tracker_service.h" #include "components/user_prefs/user_prefs.h" #include "content/public/browser/web_contents.h" #include "content/public/test/mock_render_process_host.h" @@ -267,10 +269,12 @@ class TestAutofillDialogController } void Init(content::BrowserContext* browser_context) { + Profile* profile = Profile::FromBrowserContext(browser_context); test_manager_.Init(WebDataServiceFactory::GetAutofillWebDataForProfile( - Profile::FromBrowserContext(browser_context), + profile, ServiceAccessType::EXPLICIT_ACCESS), user_prefs::UserPrefs::Get(browser_context), + AccountTrackerServiceFactory::GetForProfile(profile), browser_context->IsOffTheRecord()); } diff --git a/chrome/browser/ui/autofill/country_combobox_model_unittest.cc b/chrome/browser/ui/autofill/country_combobox_model_unittest.cc index c243d8e..1952c14 100644 --- a/chrome/browser/ui/autofill/country_combobox_model_unittest.cc +++ b/chrome/browser/ui/autofill/country_combobox_model_unittest.cc @@ -6,9 +6,11 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/signin/account_tracker_service_factory.h" #include "chrome/test/base/testing_profile.h" #include "components/autofill/core/browser/autofill_country.h" #include "components/autofill/core/browser/test_personal_data_manager.h" +#include "components/signin/core/browser/account_tracker_service.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui.h" #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui_component.h" @@ -19,7 +21,9 @@ namespace autofill { class CountryComboboxModelTest : public testing::Test { public: CountryComboboxModelTest() { - manager_.Init(NULL, profile_.GetPrefs(), false); + manager_.Init( + NULL, profile_.GetPrefs(), + AccountTrackerServiceFactory::GetForProfile(&profile_), false); manager_.set_timezone_country_code("KR"); model_.reset(new CountryComboboxModel()); model_->SetCountries(manager_, base::Callback<bool(const std::string&)>()); diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller_unittest.mm index d93356f..d979bbe 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller_unittest.mm @@ -468,7 +468,7 @@ TEST_F(BookmarkBubbleControllerTest, SyncPromoNotSignedIn) { // Confirm that the sync promo is not displayed when the user is signed in. TEST_F(BookmarkBubbleControllerTest, SyncPromoSignedIn) { SigninManager* signin = SigninManagerFactory::GetForProfile(profile()); - signin->SetAuthenticatedUsername("fake_username"); + signin->SetAuthenticatedAccountInfo("fake_username", "fake_username"); const BookmarkNode* node = CreateTestBookmark(); BookmarkBubbleController* controller = ControllerForNode(node); diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm index 2a4958e..2b1afd9 100644 --- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm @@ -370,7 +370,7 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) { // Set up the signin manager and the OAuth2Tokens. Profile* profile = browser()->profile(); SigninManagerFactory::GetForProfile(profile)-> - SetAuthenticatedUsername(kEmail); + SetAuthenticatedAccountInfo(kEmail, kEmail); ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> UpdateCredentials(kEmail, kLoginToken); ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> diff --git a/chrome/browser/ui/search/search_tab_helper_unittest.cc b/chrome/browser/ui/search/search_tab_helper_unittest.cc index 9855cc4..850a574 100644 --- a/chrome/browser/ui/search/search_tab_helper_unittest.cc +++ b/chrome/browser/ui/search/search_tab_helper_unittest.cc @@ -99,7 +99,7 @@ class SearchTabHelperTest : public ChromeRenderViewHostTestHarness { if (!username.empty()) { ASSERT_TRUE(signin_manager); - signin_manager->SetAuthenticatedUsername(username); + signin_manager->SetAuthenticatedAccountInfo(username, username); } } diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc index ad9d1f2..9c347ba 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc @@ -73,6 +73,7 @@ void SetUserChoiceHistogram(SigninChoice choice) { OneClickSigninSyncStarter::OneClickSigninSyncStarter( Profile* profile, Browser* browser, + const std::string& gaia_id, const std::string& email, const std::string& password, const std::string& refresh_token, @@ -98,7 +99,7 @@ OneClickSigninSyncStarter::OneClickSigninSyncStarter( // before signin completes. SigninManagerFactory::GetForProfile(profile_)-> StartSignInWithRefreshToken( - refresh_token, email, password, + refresh_token, gaia_id, email, password, base::Bind(&OneClickSigninSyncStarter::ConfirmSignin, weak_pointer_factory_.GetWeakPtr())); } @@ -149,7 +150,7 @@ void OneClickSigninSyncStarter::Initialize(Profile* profile, Browser* browser) { void OneClickSigninSyncStarter::ConfirmSignin(const std::string& oauth_token) { DCHECK(!oauth_token.empty()); SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); - // If this is a new signin (no authenticated username yet) try loading + // If this is a new signin (no account authenticated yet) try loading // policy for this user now, before any signed in services are initialized. if (!signin->IsAuthenticated()) { #if defined(ENABLE_CONFIGURATION_POLICY) diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.h b/chrome/browser/ui/sync/one_click_signin_sync_starter.h index b66f918..f5b6466 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.h +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.h @@ -94,6 +94,7 @@ class OneClickSigninSyncStarter : public SigninTracker::Observer, // It can be empty. OneClickSigninSyncStarter(Profile* profile, Browser* browser, + const std::string& gaia_id, const std::string& email, const std::string& password, const std::string& refresh_token, diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc index 10b5228..571f624 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc @@ -8,18 +8,23 @@ #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +#include "chrome/browser/signin/account_tracker_service_factory.h" #include "chrome/browser/signin/fake_signin_manager.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" +#include "components/signin/core/browser/account_tracker_service.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" namespace { + +const char* kTestingGaiaId = "gaia_id"; const char* kTestingUsername = "fake_username"; + } // namespace class OneClickSigninSyncStarterTest : public ChromeRenderViewHostTestHarness { @@ -41,7 +46,8 @@ class OneClickSigninSyncStarterTest : public ChromeRenderViewHostTestHarness { SigninManagerFactory::GetForProfile(profile())); signin_manager->Initialize(NULL); - signin_manager->SetAuthenticatedUsername(kTestingUsername); + signin_manager->SetAuthenticatedAccountInfo(kTestingGaiaId, + kTestingUsername); } void Callback(OneClickSigninSyncStarter::SyncSetupResult result) { @@ -67,6 +73,7 @@ class OneClickSigninSyncStarterTest : public ChromeRenderViewHostTestHarness { sync_starter_ = new OneClickSigninSyncStarter( profile(), NULL, + kTestingGaiaId, kTestingUsername, std::string(), "refresh_token", diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc index 25dae71..14fe038 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc @@ -69,10 +69,11 @@ class BookmarkBubbleViewTest : public BrowserWithTestWindowTest { void SetUpSigninManager(const std::string& username) { if (username.empty()) return; + SigninManagerBase* signin_manager = static_cast<SigninManagerBase*>( SigninManagerFactory::GetForProfile(profile())); ASSERT_TRUE(signin_manager); - signin_manager->SetAuthenticatedUsername(username); + signin_manager->SetAuthenticatedAccountInfo(username, username); } scoped_ptr<BookmarkBubbleView> bubble_; diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc index fb99545..45d41c8 100644 --- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc +++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc @@ -275,6 +275,7 @@ const char kURLRegisterComplete[] = const char kURLGaiaToken[] = "https://accounts.google.com/o/oauth2/token"; +const char kSampleGaiaId[] = "12345"; const char kSampleUser[] = "user@host.com"; class TestMessageLoopCondition { @@ -364,7 +365,7 @@ class LocalDiscoveryUITest : public WebUIBrowserTest { SigninManagerFactory::GetForProfile(browser()->profile()); DCHECK(signin_manager); - signin_manager->SetAuthenticatedUsername(kSampleUser); + signin_manager->SetAuthenticatedAccountInfo(kSampleGaiaId, kSampleUser); fake_fetcher_factory().SetFakeResponse( GURL(kURLInfo), diff --git a/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.cc b/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.cc index d51fd41..ba10be6 100644 --- a/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.cc +++ b/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.cc @@ -139,7 +139,8 @@ class SharedOptionsTest : public LoginManagerTest { Browser* CreateBrowserForUser(const user_manager::User* user) { Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); SigninManagerFactory::GetForProfile(profile)-> - SetAuthenticatedUsername(user->email()); + SetAuthenticatedAccountInfo(GetGaiaIDForUserID(user->email()), + user->email()); ui_test_utils::BrowserAddedObserver observer; Browser* browser = CreateBrowser(profile); diff --git a/chrome/browser/ui/webui/options/options_ui_browsertest.cc b/chrome/browser/ui/webui/options/options_ui_browsertest.cc index 091f4c3..284c38a 100644 --- a/chrome/browser/ui/webui/options/options_ui_browsertest.cc +++ b/chrome/browser/ui/webui/options/options_ui_browsertest.cc @@ -9,6 +9,7 @@ #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/signin/account_tracker_service_factory.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/chrome_pages.h" @@ -18,6 +19,7 @@ #include "chrome/common/url_constants.h" #include "chrome/grit/generated_resources.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/signin_manager.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_frame_host.h" @@ -248,10 +250,13 @@ IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, MAYBE_VerifyManagedSignout) { } IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, VerifyUnmanagedSignout) { + const std::string user = "test@example.com"; + std::string account_id = + AccountTrackerServiceFactory::GetForProfile(browser()->profile()) + ->SeedAccountInfo("12345", user); SigninManager* signin = SigninManagerFactory::GetForProfile(browser()->profile()); - const std::string user = "test@example.com"; - signin->OnExternalSigninCompleted(user); + signin->OnExternalSigninCompleted(account_id); NavigateToSettingsFrame(); diff --git a/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc index 92fd14d..db05b3c 100644 --- a/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc +++ b/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc @@ -276,7 +276,7 @@ class SyncSetupHandlerTest : public testing::Test { SigninManagerFactory::GetForProfile(profile_.get())); std::string username = GetTestUser(); if (!username.empty()) - mock_signin_->SetAuthenticatedUsername(username); + mock_signin_->SetAuthenticatedAccountInfo(username, username); mock_pss_ = static_cast<ProfileSyncServiceMock*>( ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( @@ -865,7 +865,7 @@ TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) { GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); SetupInitializedProfileSyncService(); - mock_signin_->SetAuthenticatedUsername(kTestUser); + mock_signin_->SetAuthenticatedAccountInfo(kTestUser, kTestUser); FakeAuthStatusProvider provider( SigninErrorControllerFactory::GetForProfile(profile_.get())); provider.SetAuthError(kTestUser, kTestUser, error_); diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc index a76a764..697d92f 100644 --- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc +++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc @@ -306,13 +306,10 @@ void InlineSigninHelper::OnClientOAuthSuccess(const ClientOAuthResult& result) { AboutSigninInternalsFactory::GetForProfile(profile_); about_signin_internals->OnRefreshTokenReceived("Successful"); - AccountTrackerService* account_tracker = - AccountTrackerServiceFactory::GetForProfile(profile_); - std::string account_id = - account_tracker->PickAccountIdForAccount(gaia_id_, email_); - // Prime the account tracker with this combination of gaia id/display email. - account_tracker->SeedAccountInfo(gaia_id_, email_); + std::string account_id = + AccountTrackerServiceFactory::GetForProfile(profile_) + ->SeedAccountInfo(gaia_id_, email_); signin_metrics::Source source = signin::GetSourceForPromoURL(current_url_); @@ -387,7 +384,7 @@ void InlineSigninHelper::OnClientOAuthSuccess(const ClientOAuthResult& result) { // OneClickSigninSyncStarter will delete itself once the job is done. new OneClickSigninSyncStarter( profile_, browser, - email_, password_, result.refresh_token, + gaia_id_, email_, password_, result.refresh_token, start_mode, contents, confirmation_required, @@ -448,7 +445,7 @@ void InlineSigninHelper::ConfirmEmailAction( break; case ConfirmEmailDialogDelegate::START_SYNC: new OneClickSigninSyncStarter( - profile_, browser, email_, password_, refresh_token, + profile_, browser, gaia_id_, email_, password_, refresh_token, start_mode, web_contents, confirmation_required, GURL(), base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); break; diff --git a/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc b/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc index 1f822e6..f34482f 100644 --- a/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc +++ b/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc @@ -137,7 +137,7 @@ void InlineLoginUIBrowserTest::SetUpSigninManager(const std::string& username) { SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(browser()->profile()); - signin_manager->SetAuthenticatedUsername(username); + signin_manager->SetAuthenticatedAccountInfo(username, username); } void InlineLoginUIBrowserTest::EnableSigninAllowed(bool enable) { |