| OLD | NEW |
| 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 Loading... |
| 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_, base::Bind(&ChromeSigninClient::OnCloseBrowsersSuccess, | 289 profile_, |
| 284 base::Unretained(this), sign_out), | 290 base::Bind(&ChromeSigninClient::OnCloseBrowsersSuccess, |
| 291 base::Unretained(this), sign_out, signout_source_metric), |
| 285 base::Bind(&ChromeSigninClient::OnCloseBrowsersAborted, | 292 base::Bind(&ChromeSigninClient::OnCloseBrowsersAborted, |
| 286 base::Unretained(this))); | 293 base::Unretained(this))); |
| 287 } else { | 294 } else { |
| 288 #else | 295 #else |
| 289 { | 296 { |
| 290 #endif | 297 #endif |
| 291 SigninClient::PreSignOut(sign_out); | 298 SigninClient::PreSignOut(sign_out, signout_source_metric); |
| 292 } | 299 } |
| 293 } | 300 } |
| 294 | 301 |
| 295 void ChromeSigninClient::OnErrorChanged() { | 302 void ChromeSigninClient::OnErrorChanged() { |
| 296 // Some tests don't have a ProfileManager. | 303 // Some tests don't have a ProfileManager. |
| 297 if (g_browser_process->profile_manager() == nullptr) | 304 if (g_browser_process->profile_manager() == nullptr) |
| 298 return; | 305 return; |
| 299 | 306 |
| 300 ProfileAttributesEntry* entry; | 307 ProfileAttributesEntry* entry; |
| 301 | 308 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 if (is_force_signin_enabled_) { | 429 if (is_force_signin_enabled_) { |
| 423 // The signout after credential copy won't open UserManager after all | 430 // The signout after credential copy won't open UserManager after all |
| 424 // browser window are closed. Because the browser window will be opened for | 431 // browser window are closed. Because the browser window will be opened for |
| 425 // the new profile soon. | 432 // the new profile soon. |
| 426 should_display_user_manager_ = false; | 433 should_display_user_manager_ = false; |
| 427 } | 434 } |
| 428 } | 435 } |
| 429 | 436 |
| 430 void ChromeSigninClient::OnCloseBrowsersSuccess( | 437 void ChromeSigninClient::OnCloseBrowsersSuccess( |
| 431 const base::Callback<void()>& sign_out, | 438 const base::Callback<void()>& sign_out, |
| 439 const signin_metrics::ProfileSignout signout_source_metric, |
| 432 const base::FilePath& profile_path) { | 440 const base::FilePath& profile_path) { |
| 433 SigninClient::PreSignOut(sign_out); | 441 SigninClient::PreSignOut(sign_out, signout_source_metric); |
| 434 | 442 |
| 435 LockForceSigninProfile(profile_path); | 443 LockForceSigninProfile(profile_path); |
| 436 // After sign out, lock the profile and show UserManager if necessary. | 444 // After sign out, lock the profile and show UserManager if necessary. |
| 437 if (should_display_user_manager_) { | 445 if (should_display_user_manager_) { |
| 438 ShowUserManager(profile_path); | 446 ShowUserManager(profile_path); |
| 439 } else { | 447 } else { |
| 440 should_display_user_manager_ = true; | 448 should_display_user_manager_ = true; |
| 441 } | 449 } |
| 442 } | 450 } |
| 443 | 451 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 457 return; | 465 return; |
| 458 entry->LockForceSigninProfile(true); | 466 entry->LockForceSigninProfile(true); |
| 459 } | 467 } |
| 460 | 468 |
| 461 void ChromeSigninClient::ShowUserManager(const base::FilePath& profile_path) { | 469 void ChromeSigninClient::ShowUserManager(const base::FilePath& profile_path) { |
| 462 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 470 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 463 UserManager::Show(profile_path, profiles::USER_MANAGER_NO_TUTORIAL, | 471 UserManager::Show(profile_path, profiles::USER_MANAGER_NO_TUTORIAL, |
| 464 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 472 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
| 465 #endif | 473 #endif |
| 466 } | 474 } |
| OLD | NEW |