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

Side by Side Diff: chrome/browser/signin/chrome_signin_client.cc

Issue 2712883005: Sign out profile when local_state file has been changed. (Closed)
Patch Set: Merge from master Created 3 years, 9 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.h ('k') | chrome/browser/signin/signin_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/signin/chrome_signin_client.h" 5 #include "chrome/browser/signin/chrome_signin_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 void ChromeSigninClient::PostSignedIn(const std::string& account_id, 268 void ChromeSigninClient::PostSignedIn(const std::string& account_id,
269 const std::string& username, 269 const std::string& username,
270 const std::string& password) { 270 const std::string& password) {
271 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 271 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
272 // Don't store password hash except when lock is available for the user. 272 // Don't store password hash except when lock is available for the user.
273 if (!password.empty() && profiles::IsLockAvailable(profile_)) 273 if (!password.empty() && profiles::IsLockAvailable(profile_))
274 LocalAuth::SetLocalAuthCredentials(profile_, password); 274 LocalAuth::SetLocalAuthCredentials(profile_, password);
275 #endif 275 #endif
276 } 276 }
277 277
278 void ChromeSigninClient::PreSignOut(const base::Callback<void()>& sign_out) { 278 void ChromeSigninClient::PreSignOut(
279 const base::Callback<void()>& sign_out,
280 signin_metrics::ProfileSignout signout_source_metric) {
279 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 281 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
280 if (is_force_signin_enabled_ && !profile_->IsSystemProfile() && 282 if (is_force_signin_enabled_ && !profile_->IsSystemProfile() &&
281 !profile_->IsGuestSession() && !profile_->IsSupervised()) { 283 !profile_->IsGuestSession() && !profile_->IsSupervised()) {
284 // TODO(zmin): force window closing based on the reason of sign-out.
285 // This will be updated after force window closing CL is commited.
286
287 // User can't abort the window closing unless user sign out manually.
282 BrowserList::CloseAllBrowsersWithProfile( 288 BrowserList::CloseAllBrowsersWithProfile(
283 profile_, 289 profile_,
284 base::Bind(&ChromeSigninClient::OnCloseBrowsersSuccess, 290 base::Bind(&ChromeSigninClient::OnCloseBrowsersSuccess,
285 base::Unretained(this), sign_out), 291 base::Unretained(this), sign_out, signout_source_metric),
286 base::Bind(&ChromeSigninClient::OnCloseBrowsersAborted, 292 base::Bind(&ChromeSigninClient::OnCloseBrowsersAborted,
287 base::Unretained(this)), 293 base::Unretained(this)),
288 false); 294 false);
289 } else { 295 } else {
290 #else 296 #else
291 { 297 {
292 #endif 298 #endif
293 SigninClient::PreSignOut(sign_out); 299 SigninClient::PreSignOut(sign_out, signout_source_metric);
294 } 300 }
295 } 301 }
296 302
297 void ChromeSigninClient::OnErrorChanged() { 303 void ChromeSigninClient::OnErrorChanged() {
298 // Some tests don't have a ProfileManager. 304 // Some tests don't have a ProfileManager.
299 if (g_browser_process->profile_manager() == nullptr) 305 if (g_browser_process->profile_manager() == nullptr)
300 return; 306 return;
301 307
302 ProfileAttributesEntry* entry; 308 ProfileAttributesEntry* entry;
303 309
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 if (is_force_signin_enabled_) { 430 if (is_force_signin_enabled_) {
425 // The signout after credential copy won't open UserManager after all 431 // The signout after credential copy won't open UserManager after all
426 // browser window are closed. Because the browser window will be opened for 432 // browser window are closed. Because the browser window will be opened for
427 // the new profile soon. 433 // the new profile soon.
428 should_display_user_manager_ = false; 434 should_display_user_manager_ = false;
429 } 435 }
430 } 436 }
431 437
432 void ChromeSigninClient::OnCloseBrowsersSuccess( 438 void ChromeSigninClient::OnCloseBrowsersSuccess(
433 const base::Callback<void()>& sign_out, 439 const base::Callback<void()>& sign_out,
440 const signin_metrics::ProfileSignout signout_source_metric,
434 const base::FilePath& profile_path) { 441 const base::FilePath& profile_path) {
435 SigninClient::PreSignOut(sign_out); 442 SigninClient::PreSignOut(sign_out, signout_source_metric);
436 443
437 LockForceSigninProfile(profile_path); 444 LockForceSigninProfile(profile_path);
438 // After sign out, lock the profile and show UserManager if necessary. 445 // After sign out, lock the profile and show UserManager if necessary.
439 if (should_display_user_manager_) { 446 if (should_display_user_manager_) {
440 ShowUserManager(profile_path); 447 ShowUserManager(profile_path);
441 } else { 448 } else {
442 should_display_user_manager_ = true; 449 should_display_user_manager_ = true;
443 } 450 }
444 } 451 }
445 452
(...skipping 13 matching lines...) Expand all
459 return; 466 return;
460 entry->LockForceSigninProfile(true); 467 entry->LockForceSigninProfile(true);
461 } 468 }
462 469
463 void ChromeSigninClient::ShowUserManager(const base::FilePath& profile_path) { 470 void ChromeSigninClient::ShowUserManager(const base::FilePath& profile_path) {
464 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 471 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
465 UserManager::Show(profile_path, profiles::USER_MANAGER_NO_TUTORIAL, 472 UserManager::Show(profile_path, profiles::USER_MANAGER_NO_TUTORIAL,
466 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); 473 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
467 #endif 474 #endif
468 } 475 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.h ('k') | chrome/browser/signin/signin_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698