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

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

Issue 508433004: Store local auth credentials after successful login or re-auth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 6 years, 3 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
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chrome_signin_client_factory.h" 16 #include "chrome/browser/signin/chrome_signin_client_factory.h"
17 #include "chrome/browser/signin/local_auth.h"
17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
18 #include "chrome/browser/signin/signin_manager_factory.h" 19 #include "chrome/browser/signin/signin_manager_factory.h"
19 #include "chrome/browser/sync/profile_sync_service.h" 20 #include "chrome/browser/sync/profile_sync_service.h"
20 #include "chrome/browser/sync/profile_sync_service_factory.h" 21 #include "chrome/browser/sync/profile_sync_service_factory.h"
21 #include "chrome/browser/ui/browser_finder.h" 22 #include "chrome/browser/ui/browser_finder.h"
22 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
23 #include "chrome/browser/ui/sync/one_click_signin_helper.h" 24 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
24 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" 25 #include "chrome/browser/ui/sync/one_click_signin_histogram.h"
25 #include "chrome/browser/ui/tabs/tab_strip_model.h" 26 #include "chrome/browser/ui/tabs/tab_strip_model.h"
26 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" 27 #include "chrome/browser/ui/webui/signin/inline_login_ui.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 const std::string& display_email, 109 const std::string& display_email,
109 const std::string& refresh_token) { 110 const std::string& refresh_token) {
110 content::WebContents* contents = NULL; 111 content::WebContents* contents = NULL;
111 Browser* browser = NULL; 112 Browser* browser = NULL;
112 if (handler_) { 113 if (handler_) {
113 contents = handler_->web_ui()->GetWebContents(); 114 contents = handler_->web_ui()->GetWebContents();
114 browser = handler_->GetDesktopBrowser(); 115 browser = handler_->GetDesktopBrowser();
115 } 116 }
116 117
117 AboutSigninInternals* about_signin_internals = 118 AboutSigninInternals* about_signin_internals =
118 AboutSigninInternalsFactory::GetForProfile(profile_); 119 AboutSigninInternalsFactory::GetForProfile(profile_);
119 about_signin_internals->OnRefreshTokenReceived("Successful"); 120 about_signin_internals->OnRefreshTokenReceived("Successful");
120 121
121 signin::Source source = signin::GetSourceForPromoURL(current_url_); 122 signin::Source source = signin::GetSourceForPromoURL(current_url_);
123
124 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
125 std::string primary_email =
126 SigninManagerFactory::GetForProfile(profile_)->GetAuthenticatedUsername();
127 if (gaia::AreEmailsSame(email, primary_email) &&
128 source == signin::SOURCE_REAUTH &&
129 switches::IsNewProfileManagement()) {
130 chrome::SetLocalAuthCredentials(profile_, password_);
131 }
132 #endif
Roger Tawa OOO till Jul 10th 2014/08/26 17:01:12 Don't really need the #ifdef here because this fil
Marc Treib 2014/08/27 07:34:51 Ah thanks, I didn't know that. I removed it again.
133
122 if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT || 134 if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT ||
123 source == signin::SOURCE_REAUTH) { 135 source == signin::SOURCE_REAUTH) {
124 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> 136 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
125 UpdateCredentials(email, refresh_token); 137 UpdateCredentials(email, refresh_token);
126 138
127 if (signin::IsAutoCloseEnabledInURL(current_url_)) { 139 if (signin::IsAutoCloseEnabledInURL(current_url_)) {
128 // Close the gaia sign in tab via a task to make sure we aren't in the 140 // Close the gaia sign in tab via a task to make sure we aren't in the
129 // middle of any webui handler code. 141 // middle of any webui handler code.
130 base::MessageLoop::current()->PostTask( 142 base::MessageLoop::current()->PostTask(
131 FROM_HERE, 143 FROM_HERE,
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 451 }
440 } 452 }
441 453
442 if (show_account_management) { 454 if (show_account_management) {
443 browser->window()->ShowAvatarBubbleFromAvatarButton( 455 browser->window()->ShowAvatarBubbleFromAvatarButton(
444 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, 456 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT,
445 signin::ManageAccountsParams()); 457 signin::ManageAccountsParams());
446 } 458 }
447 } 459 }
448 } 460 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698