| 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/ui/cocoa/profiles/user_manager_mac.h" | 5 #include "chrome/browser/ui/cocoa/profiles/user_manager_mac.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #import "chrome/browser/app_controller_mac.h" | 10 #import "chrome/browser/app_controller_mac.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 - (void)closeDialog { | 406 - (void)closeDialog { |
| 407 [dialog_window_controller_ close]; | 407 [dialog_window_controller_ close]; |
| 408 } | 408 } |
| 409 | 409 |
| 410 @end | 410 @end |
| 411 | 411 |
| 412 | 412 |
| 413 // static | 413 // static |
| 414 void UserManager::Show( | 414 void UserManager::Show( |
| 415 const base::FilePath& profile_path_to_focus, | 415 const base::FilePath& profile_path_to_focus, |
| 416 profiles::UserManagerTutorialMode tutorial_mode, | |
| 417 profiles::UserManagerAction user_manager_action) { | 416 profiles::UserManagerAction user_manager_action) { |
| 418 DCHECK(profile_path_to_focus != ProfileManager::GetGuestProfilePath()); | 417 DCHECK(profile_path_to_focus != ProfileManager::GetGuestProfilePath()); |
| 419 | 418 |
| 420 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::OPEN_USER_MANAGER); | 419 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::OPEN_USER_MANAGER); |
| 421 if (instance_) { | 420 if (instance_) { |
| 422 // If there's a user manager window open already, just activate it. | 421 // If there's a user manager window open already, just activate it. |
| 423 [instance_->window_controller() show]; | 422 [instance_->window_controller() show]; |
| 424 instance_->set_user_manager_started_showing(base::Time::Now()); | 423 instance_->set_user_manager_started_showing(base::Time::Now()); |
| 425 return; | 424 return; |
| 426 } | 425 } |
| 427 | 426 |
| 428 // Under some startup conditions, we can try twice to create the User Manager. | 427 // Under some startup conditions, we can try twice to create the User Manager. |
| 429 // Because creating the System profile is asynchronous, it's possible for | 428 // Because creating the System profile is asynchronous, it's possible for |
| 430 // there to then be multiple pending operations and eventually multiple | 429 // there to then be multiple pending operations and eventually multiple |
| 431 // User Managers. | 430 // User Managers. |
| 432 if (instance_under_construction_) | 431 if (instance_under_construction_) |
| 433 return; | 432 return; |
| 434 instance_under_construction_ = YES; | 433 instance_under_construction_ = YES; |
| 435 | 434 |
| 436 // Create the guest profile, if necessary, and open the User Manager | 435 // Create the guest profile, if necessary, and open the User Manager |
| 437 // from the guest profile. | 436 // from the guest profile. |
| 438 profiles::CreateSystemProfileForUserManager( | 437 profiles::CreateSystemProfileForUserManager( |
| 439 profile_path_to_focus, | 438 profile_path_to_focus, |
| 440 tutorial_mode, | |
| 441 user_manager_action, | 439 user_manager_action, |
| 442 base::Bind(&UserManagerMac::OnSystemProfileCreated, base::Time::Now())); | 440 base::Bind(&UserManagerMac::OnSystemProfileCreated, base::Time::Now())); |
| 443 } | 441 } |
| 444 | 442 |
| 445 // static | 443 // static |
| 446 void UserManager::Hide() { | 444 void UserManager::Hide() { |
| 447 if (instance_) | 445 if (instance_) |
| 448 [instance_->window_controller() close]; | 446 [instance_->window_controller() close]; |
| 449 } | 447 } |
| 450 | 448 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 [window_controller_ displayErrorMessage]; | 581 [window_controller_ displayErrorMessage]; |
| 584 } | 582 } |
| 585 | 583 |
| 586 void UserManagerMac::SetSigninProfilePath(const base::FilePath& profile_path) { | 584 void UserManagerMac::SetSigninProfilePath(const base::FilePath& profile_path) { |
| 587 signin_profile_path_ = profile_path; | 585 signin_profile_path_ = profile_path; |
| 588 } | 586 } |
| 589 | 587 |
| 590 base::FilePath UserManagerMac::GetSigninProfilePath() { | 588 base::FilePath UserManagerMac::GetSigninProfilePath() { |
| 591 return signin_profile_path_; | 589 return signin_profile_path_; |
| 592 } | 590 } |
| OLD | NEW |