| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void RecordPasswordLoginEvent(const UserContext& user_context) { | 132 void RecordPasswordLoginEvent(const UserContext& user_context) { |
| 133 EasyUnlockService* easy_unlock_service = | 133 EasyUnlockService* easy_unlock_service = |
| 134 EasyUnlockService::Get(ProfileHelper::GetSigninProfile()); | 134 EasyUnlockService::Get(ProfileHelper::GetSigninProfile()); |
| 135 if (user_context.GetUserType() == user_manager::USER_TYPE_REGULAR && | 135 if (user_context.GetUserType() == user_manager::USER_TYPE_REGULAR && |
| 136 user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE && | 136 user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE && |
| 137 easy_unlock_service) { | 137 easy_unlock_service) { |
| 138 easy_unlock_service->RecordPasswordLoginEvent(user_context.GetUserID()); | 138 easy_unlock_service->RecordPasswordLoginEvent(user_context.GetUserID()); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 bool CanShowDebuggingFeatures() { |
| 143 // We need to be on the login screen and in dev mode to show this menu item. |
| 144 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 145 chromeos::switches::kSystemDevMode) && |
| 146 CommandLine::ForCurrentProcess()->HasSwitch( |
| 147 chromeos::switches::kLoginManager) && |
| 148 !user_manager::UserManager::Get()->IsSessionStarted(); |
| 149 } |
| 150 |
| 142 } // namespace | 151 } // namespace |
| 143 | 152 |
| 144 // static | 153 // static |
| 145 ExistingUserController* ExistingUserController::current_controller_ = NULL; | 154 ExistingUserController* ExistingUserController::current_controller_ = NULL; |
| 146 | 155 |
| 147 //////////////////////////////////////////////////////////////////////////////// | 156 //////////////////////////////////////////////////////////////////////////////// |
| 148 // ExistingUserController, public: | 157 // ExistingUserController, public: |
| 149 | 158 |
| 150 ExistingUserController::ExistingUserController(LoginDisplayHost* host) | 159 ExistingUserController::ExistingUserController(LoginDisplayHost* host) |
| 151 : auth_status_consumer_(NULL), | 160 : auth_status_consumer_(NULL), |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 LOG(WARNING) << "Enterprise enrollment is not available after kiosk auto " | 571 LOG(WARNING) << "Enterprise enrollment is not available after kiosk auto " |
| 563 "launch is set."; | 572 "launch is set."; |
| 564 return; | 573 return; |
| 565 } | 574 } |
| 566 | 575 |
| 567 DeviceSettingsService::Get()->GetOwnershipStatusAsync( | 576 DeviceSettingsService::Get()->GetOwnershipStatusAsync( |
| 568 base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted, | 577 base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted, |
| 569 weak_factory_.GetWeakPtr())); | 578 weak_factory_.GetWeakPtr())); |
| 570 } | 579 } |
| 571 | 580 |
| 581 void ExistingUserController::OnStartEnableDebuggingScreen() { |
| 582 if (CanShowDebuggingFeatures()) |
| 583 ShowEnableDebuggingScreen(); |
| 584 } |
| 585 |
| 572 void ExistingUserController::OnStartKioskEnableScreen() { | 586 void ExistingUserController::OnStartKioskEnableScreen() { |
| 573 KioskAppManager::Get()->GetConsumerKioskAutoLaunchStatus( | 587 KioskAppManager::Get()->GetConsumerKioskAutoLaunchStatus( |
| 574 base::Bind( | 588 base::Bind( |
| 575 &ExistingUserController::OnConsumerKioskAutoLaunchCheckCompleted, | 589 &ExistingUserController::OnConsumerKioskAutoLaunchCheckCompleted, |
| 576 weak_factory_.GetWeakPtr())); | 590 weak_factory_.GetWeakPtr())); |
| 577 } | 591 } |
| 578 | 592 |
| 579 void ExistingUserController::OnStartKioskAutolaunchScreen() { | 593 void ExistingUserController::OnStartKioskAutolaunchScreen() { |
| 580 ShowKioskAutolaunchScreen(); | 594 ShowKioskAutolaunchScreen(); |
| 581 } | 595 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 } | 651 } |
| 638 host_->StartWizard(WizardController::kEnrollmentScreenName, | 652 host_->StartWizard(WizardController::kEnrollmentScreenName, |
| 639 params.Pass()); | 653 params.Pass()); |
| 640 } | 654 } |
| 641 | 655 |
| 642 void ExistingUserController::ShowResetScreen() { | 656 void ExistingUserController::ShowResetScreen() { |
| 643 scoped_ptr<base::DictionaryValue> params; | 657 scoped_ptr<base::DictionaryValue> params; |
| 644 host_->StartWizard(WizardController::kResetScreenName, params.Pass()); | 658 host_->StartWizard(WizardController::kResetScreenName, params.Pass()); |
| 645 } | 659 } |
| 646 | 660 |
| 661 void ExistingUserController::ShowEnableDebuggingScreen() { |
| 662 scoped_ptr<base::DictionaryValue> params; |
| 663 host_->StartWizard(WizardController::kEnableDebuggingScreenName, |
| 664 params.Pass()); |
| 665 } |
| 666 |
| 647 void ExistingUserController::ShowKioskEnableScreen() { | 667 void ExistingUserController::ShowKioskEnableScreen() { |
| 648 scoped_ptr<base::DictionaryValue> params; | 668 scoped_ptr<base::DictionaryValue> params; |
| 649 host_->StartWizard(WizardController::kKioskEnableScreenName, params.Pass()); | 669 host_->StartWizard(WizardController::kKioskEnableScreenName, params.Pass()); |
| 650 } | 670 } |
| 651 | 671 |
| 652 void ExistingUserController::ShowKioskAutolaunchScreen() { | 672 void ExistingUserController::ShowKioskAutolaunchScreen() { |
| 653 scoped_ptr<base::DictionaryValue> params; | 673 scoped_ptr<base::DictionaryValue> params; |
| 654 host_->StartWizard(WizardController::kKioskAutolaunchScreenName, | 674 host_->StartWizard(WizardController::kKioskAutolaunchScreenName, |
| 655 params.Pass()); | 675 params.Pass()); |
| 656 } | 676 } |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 is_login_in_progress_ = false; | 1234 is_login_in_progress_ = false; |
| 1215 | 1235 |
| 1216 // Reenable clicking on other windows and status area. | 1236 // Reenable clicking on other windows and status area. |
| 1217 login_display_->SetUIEnabled(true); | 1237 login_display_->SetUIEnabled(true); |
| 1218 | 1238 |
| 1219 if (start_public_session_timer) | 1239 if (start_public_session_timer) |
| 1220 StartPublicSessionAutoLoginTimer(); | 1240 StartPublicSessionAutoLoginTimer(); |
| 1221 } | 1241 } |
| 1222 | 1242 |
| 1223 } // namespace chromeos | 1243 } // namespace chromeos |
| OLD | NEW |