| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/chromeos/login/signin_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/sys_info.h" | 23 #include "base/sys_info.h" |
| 24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 25 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 26 #include "chrome/browser/browser_shutdown.h" | 26 #include "chrome/browser/browser_shutdown.h" |
| 27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
| 28 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 28 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 29 #include "chrome/browser/chromeos/boot_times_loader.h" | 29 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 30 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 30 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 32 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" |
| 32 #include "chrome/browser/chromeos/login/hwid_checker.h" | 33 #include "chrome/browser/chromeos/login/hwid_checker.h" |
| 33 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 34 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 34 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 35 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
| 35 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 36 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 36 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 37 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 37 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 38 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 38 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 39 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 39 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 40 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 40 #include "chrome/browser/chromeos/login/wizard_controller.h" | 41 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 41 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 42 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 error_screen_actor_(error_screen_actor), | 270 error_screen_actor_(error_screen_actor), |
| 270 core_oobe_actor_(core_oobe_actor), | 271 core_oobe_actor_(core_oobe_actor), |
| 271 is_first_update_state_call_(true), | 272 is_first_update_state_call_(true), |
| 272 offline_login_active_(false), | 273 offline_login_active_(false), |
| 273 last_network_state_(NetworkStateInformer::UNKNOWN), | 274 last_network_state_(NetworkStateInformer::UNKNOWN), |
| 274 has_pending_auth_ui_(false), | 275 has_pending_auth_ui_(false), |
| 275 caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get() | 276 caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get() |
| 276 ->GetImeKeyboard() | 277 ->GetImeKeyboard() |
| 277 ->CapsLockIsEnabled()), | 278 ->CapsLockIsEnabled()), |
| 278 gaia_screen_handler_(gaia_screen_handler), | 279 gaia_screen_handler_(gaia_screen_handler), |
| 280 histogram_helper_(new ErrorScreensHistogramHelper("Signin")), |
| 279 weak_factory_(this) { | 281 weak_factory_(this) { |
| 280 DCHECK(network_state_informer_.get()); | 282 DCHECK(network_state_informer_.get()); |
| 281 DCHECK(error_screen_actor_); | 283 DCHECK(error_screen_actor_); |
| 282 DCHECK(core_oobe_actor_); | 284 DCHECK(core_oobe_actor_); |
| 283 DCHECK(gaia_screen_handler_); | 285 DCHECK(gaia_screen_handler_); |
| 284 gaia_screen_handler_->SetSigninScreenHandler(this); | 286 gaia_screen_handler_->SetSigninScreenHandler(this); |
| 285 network_state_informer_->AddObserver(this); | 287 network_state_informer_->AddObserver(this); |
| 286 | 288 |
| 287 registrar_.Add(this, | 289 registrar_.Add(this, |
| 288 chrome::NOTIFICATION_AUTH_NEEDED, | 290 chrome::NOTIFICATION_AUTH_NEEDED, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 if (is_enrolling_consumer_management_) { | 439 if (is_enrolling_consumer_management_) { |
| 438 // We don't check if the value of the owner e-mail is trusted because it is | 440 // We don't check if the value of the owner e-mail is trusted because it is |
| 439 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached | 441 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached |
| 440 // value is sufficient. | 442 // value is sufficient. |
| 441 CrosSettings::Get()->GetString(kDeviceOwner, &email); | 443 CrosSettings::Get()->GetString(kDeviceOwner, &email); |
| 442 } else { | 444 } else { |
| 443 email = context.email(); | 445 email = context.email(); |
| 444 } | 446 } |
| 445 gaia_screen_handler_->PopulateEmail(email); | 447 gaia_screen_handler_->PopulateEmail(email); |
| 446 ShowImpl(); | 448 ShowImpl(); |
| 449 histogram_helper_->OnScreenShow(); |
| 447 } | 450 } |
| 448 | 451 |
| 449 void SigninScreenHandler::ShowRetailModeLoginSpinner() { | 452 void SigninScreenHandler::ShowRetailModeLoginSpinner() { |
| 450 CallJS("showLoginSpinner"); | 453 CallJS("showLoginSpinner"); |
| 451 } | 454 } |
| 452 | 455 |
| 453 void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) { | 456 void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) { |
| 454 delegate_ = delegate; | 457 delegate_ = delegate; |
| 455 if (delegate_) | 458 if (delegate_) |
| 456 delegate_->SetWebUIHandler(this); | 459 delegate_->SetWebUIHandler(this); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 error_screen_actor_->error_state() != | 684 error_screen_actor_->error_state() != |
| 682 ErrorScreen::ERROR_STATE_AUTH_EXT_TIMEOUT; | 685 ErrorScreen::ERROR_STATE_AUTH_EXT_TIMEOUT; |
| 683 error_screen_actor_->AllowOfflineLogin(offline_login_allowed); | 686 error_screen_actor_->AllowOfflineLogin(offline_login_allowed); |
| 684 | 687 |
| 685 if (GetCurrentScreen() != OobeUI::SCREEN_ERROR_MESSAGE) { | 688 if (GetCurrentScreen() != OobeUI::SCREEN_ERROR_MESSAGE) { |
| 686 base::DictionaryValue params; | 689 base::DictionaryValue params; |
| 687 const std::string network_type = network_state_informer_->network_type(); | 690 const std::string network_type = network_state_informer_->network_type(); |
| 688 params.SetString("lastNetworkType", network_type); | 691 params.SetString("lastNetworkType", network_type); |
| 689 error_screen_actor_->SetUIState(ErrorScreen::UI_STATE_SIGNIN); | 692 error_screen_actor_->SetUIState(ErrorScreen::UI_STATE_SIGNIN); |
| 690 error_screen_actor_->Show(OobeUI::SCREEN_GAIA_SIGNIN, ¶ms); | 693 error_screen_actor_->Show(OobeUI::SCREEN_GAIA_SIGNIN, ¶ms); |
| 694 histogram_helper_->OnErrorShow(error_screen_actor_->error_state()); |
| 691 } | 695 } |
| 692 } | 696 } |
| 693 | 697 |
| 694 void SigninScreenHandler::HideOfflineMessage( | 698 void SigninScreenHandler::HideOfflineMessage( |
| 695 NetworkStateInformer::State state, | 699 NetworkStateInformer::State state, |
| 696 ErrorScreenActor::ErrorReason reason) { | 700 ErrorScreenActor::ErrorReason reason) { |
| 697 if (!IsSigninScreenHiddenByError()) | 701 if (!IsSigninScreenHiddenByError()) |
| 698 return; | 702 return; |
| 699 | 703 |
| 700 error_screen_actor_->Hide(); | 704 error_screen_actor_->Hide(); |
| 705 histogram_helper_->OnErrorHide(); |
| 701 | 706 |
| 702 // Forces a reload for Gaia screen on hiding error message. | 707 // Forces a reload for Gaia screen on hiding error message. |
| 703 if (IsGaiaVisible() || IsGaiaHiddenByError()) | 708 if (IsGaiaVisible() || IsGaiaHiddenByError()) |
| 704 ReloadGaia(false); | 709 ReloadGaia(false); |
| 705 } | 710 } |
| 706 | 711 |
| 707 void SigninScreenHandler::ReloadGaia(bool force_reload) { | 712 void SigninScreenHandler::ReloadGaia(bool force_reload) { |
| 708 gaia_screen_handler_->ReloadGaia(force_reload); | 713 gaia_screen_handler_->ReloadGaia(force_reload); |
| 709 } | 714 } |
| 710 | 715 |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 return gaia_screen_handler_->frame_error(); | 1511 return gaia_screen_handler_->frame_error(); |
| 1507 } | 1512 } |
| 1508 | 1513 |
| 1509 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1514 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1510 caps_lock_enabled_ = enabled; | 1515 caps_lock_enabled_ = enabled; |
| 1511 if (page_is_ready()) | 1516 if (page_is_ready()) |
| 1512 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1517 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1513 } | 1518 } |
| 1514 | 1519 |
| 1515 } // namespace chromeos | 1520 } // namespace chromeos |
| OLD | NEW |