Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: chrome/browser/ui/webui/signin/inline_login_handler_impl.cc

Issue 617183003: Make sure GetAuthenticatedAccountId() returns a canonicalized id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/signin/about_signin_internals_factory.h" 15 #include "chrome/browser/signin/about_signin_internals_factory.h"
16 #include "chrome/browser/signin/account_tracker_service_factory.h"
16 #include "chrome/browser/signin/chrome_signin_client_factory.h" 17 #include "chrome/browser/signin/chrome_signin_client_factory.h"
17 #include "chrome/browser/signin/local_auth.h" 18 #include "chrome/browser/signin/local_auth.h"
18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
19 #include "chrome/browser/signin/signin_manager_factory.h" 20 #include "chrome/browser/signin/signin_manager_factory.h"
20 #include "chrome/browser/sync/profile_sync_service.h" 21 #include "chrome/browser/sync/profile_sync_service.h"
21 #include "chrome/browser/sync/profile_sync_service_factory.h" 22 #include "chrome/browser/sync/profile_sync_service_factory.h"
22 #include "chrome/browser/ui/browser_finder.h" 23 #include "chrome/browser/ui/browser_finder.h"
23 #include "chrome/browser/ui/browser_window.h" 24 #include "chrome/browser/ui/browser_window.h"
24 #include "chrome/browser/ui/sync/one_click_signin_helper.h" 25 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
25 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" 26 #include "chrome/browser/ui/sync/one_click_signin_histogram.h"
26 #include "chrome/browser/ui/tabs/tab_strip_model.h" 27 #include "chrome/browser/ui/tabs/tab_strip_model.h"
27 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" 28 #include "chrome/browser/ui/webui/signin/inline_login_ui.h"
28 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 29 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
29 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 30 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
30 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
31 #include "components/signin/core/browser/about_signin_internals.h" 32 #include "components/signin/core/browser/about_signin_internals.h"
33 #include "components/signin/core/browser/account_tracker_service.h"
32 #include "components/signin/core/browser/profile_oauth2_token_service.h" 34 #include "components/signin/core/browser/profile_oauth2_token_service.h"
33 #include "components/signin/core/browser/signin_error_controller.h" 35 #include "components/signin/core/browser/signin_error_controller.h"
34 #include "components/signin/core/browser/signin_oauth_helper.h" 36 #include "components/signin/core/browser/signin_oauth_helper.h"
35 #include "components/signin/core/common/profile_management_switches.h" 37 #include "components/signin/core/common/profile_management_switches.h"
36 #include "content/public/browser/storage_partition.h" 38 #include "content/public/browser/storage_partition.h"
37 #include "content/public/browser/web_ui.h" 39 #include "content/public/browser/web_ui.h"
38 #include "google_apis/gaia/gaia_auth_fetcher.h" 40 #include "google_apis/gaia/gaia_auth_fetcher.h"
39 #include "google_apis/gaia/gaia_auth_util.h" 41 #include "google_apis/gaia/gaia_auth_util.h"
40 #include "google_apis/gaia/gaia_constants.h" 42 #include "google_apis/gaia/gaia_constants.h"
41 #include "google_apis/gaia/gaia_urls.h" 43 #include "google_apis/gaia/gaia_urls.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 std::string primary_email = 126 std::string primary_email =
125 SigninManagerFactory::GetForProfile(profile_)->GetAuthenticatedUsername(); 127 SigninManagerFactory::GetForProfile(profile_)->GetAuthenticatedUsername();
126 if (gaia::AreEmailsSame(email, primary_email) && 128 if (gaia::AreEmailsSame(email, primary_email) &&
127 source == signin::SOURCE_REAUTH && 129 source == signin::SOURCE_REAUTH &&
128 switches::IsNewProfileManagement()) { 130 switches::IsNewProfileManagement()) {
129 chrome::SetLocalAuthCredentials(profile_, password_); 131 chrome::SetLocalAuthCredentials(profile_, password_);
130 } 132 }
131 133
132 if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT || 134 if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT ||
133 source == signin::SOURCE_REAUTH) { 135 source == signin::SOURCE_REAUTH) {
136 // TODO(rogerta): the javascript code will need to pass in the gaia-id
137 // of the account instead of the email when chrome uses gaia-id as key.
138 DCHECK_EQ(AccountTrackerService::MIGRATION_NOT_STARTED,
139 AccountTrackerServiceFactory::GetForProfile(profile_)->
140 GetMigrationState());
141 const std::string account_id = gaia::CanonicalizeEmail(email);
134 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> 142 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
135 UpdateCredentials(email, refresh_token); 143 UpdateCredentials(account_id, refresh_token);
136 144
137 if (signin::IsAutoCloseEnabledInURL(current_url_)) { 145 if (signin::IsAutoCloseEnabledInURL(current_url_)) {
138 // Close the gaia sign in tab via a task to make sure we aren't in the 146 // Close the gaia sign in tab via a task to make sure we aren't in the
139 // middle of any webui handler code. 147 // middle of any webui handler code.
140 base::MessageLoop::current()->PostTask( 148 base::MessageLoop::current()->PostTask(
141 FROM_HERE, 149 FROM_HERE,
142 base::Bind(&InlineLoginHandlerImpl::CloseTab, 150 base::Bind(&InlineLoginHandlerImpl::CloseTab,
143 handler_, 151 handler_,
144 signin::ShouldShowAccountManagement(current_url_))); 152 signin::ShouldShowAccountManagement(current_url_)));
145 } 153 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 } 458 }
451 } 459 }
452 460
453 if (show_account_management) { 461 if (show_account_management) {
454 browser->window()->ShowAvatarBubbleFromAvatarButton( 462 browser->window()->ShowAvatarBubbleFromAvatarButton(
455 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, 463 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT,
456 signin::ManageAccountsParams()); 464 signin::ManageAccountsParams());
457 } 465 }
458 } 466 }
459 } 467 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/search/people/people_provider.cc ('k') | components/enhanced_bookmarks/bookmark_server_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698