| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 if (is_enrolling_consumer_management_) { | 434 if (is_enrolling_consumer_management_) { |
| 433 // We don't check if the value of the owner e-mail is trusted because it is | 435 // We don't check if the value of the owner e-mail is trusted because it is |
| 434 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached | 436 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached |
| 435 // value is sufficient. | 437 // value is sufficient. |
| 436 CrosSettings::Get()->GetString(kDeviceOwner, &email); | 438 CrosSettings::Get()->GetString(kDeviceOwner, &email); |
| 437 } else { | 439 } else { |
| 438 email = context.email(); | 440 email = context.email(); |
| 439 } | 441 } |
| 440 gaia_screen_handler_->PopulateEmail(email); | 442 gaia_screen_handler_->PopulateEmail(email); |
| 441 ShowImpl(); | 443 ShowImpl(); |
| 444 histogram_helper_->OnScreenShow(); |
| 442 } | 445 } |
| 443 | 446 |
| 444 void SigninScreenHandler::ShowRetailModeLoginSpinner() { | 447 void SigninScreenHandler::ShowRetailModeLoginSpinner() { |
| 445 CallJS("showLoginSpinner"); | 448 CallJS("showLoginSpinner"); |
| 446 } | 449 } |
| 447 | 450 |
| 448 void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) { | 451 void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) { |
| 449 delegate_ = delegate; | 452 delegate_ = delegate; |
| 450 if (delegate_) | 453 if (delegate_) |
| 451 delegate_->SetWebUIHandler(this); | 454 delegate_->SetWebUIHandler(this); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 error_screen_actor_->error_state() != | 679 error_screen_actor_->error_state() != |
| 677 ErrorScreen::ERROR_STATE_AUTH_EXT_TIMEOUT; | 680 ErrorScreen::ERROR_STATE_AUTH_EXT_TIMEOUT; |
| 678 error_screen_actor_->AllowOfflineLogin(offline_login_allowed); | 681 error_screen_actor_->AllowOfflineLogin(offline_login_allowed); |
| 679 | 682 |
| 680 if (GetCurrentScreen() != OobeUI::SCREEN_ERROR_MESSAGE) { | 683 if (GetCurrentScreen() != OobeUI::SCREEN_ERROR_MESSAGE) { |
| 681 base::DictionaryValue params; | 684 base::DictionaryValue params; |
| 682 const std::string network_type = network_state_informer_->network_type(); | 685 const std::string network_type = network_state_informer_->network_type(); |
| 683 params.SetString("lastNetworkType", network_type); | 686 params.SetString("lastNetworkType", network_type); |
| 684 error_screen_actor_->SetUIState(ErrorScreen::UI_STATE_SIGNIN); | 687 error_screen_actor_->SetUIState(ErrorScreen::UI_STATE_SIGNIN); |
| 685 error_screen_actor_->Show(OobeUI::SCREEN_GAIA_SIGNIN, ¶ms); | 688 error_screen_actor_->Show(OobeUI::SCREEN_GAIA_SIGNIN, ¶ms); |
| 689 histogram_helper_->OnErrorShow(error_screen_actor_->error_state()); |
| 686 } | 690 } |
| 687 } | 691 } |
| 688 | 692 |
| 689 void SigninScreenHandler::HideOfflineMessage( | 693 void SigninScreenHandler::HideOfflineMessage( |
| 690 NetworkStateInformer::State state, | 694 NetworkStateInformer::State state, |
| 691 ErrorScreenActor::ErrorReason reason) { | 695 ErrorScreenActor::ErrorReason reason) { |
| 692 if (!IsSigninScreenHiddenByError()) | 696 if (!IsSigninScreenHiddenByError()) |
| 693 return; | 697 return; |
| 694 | 698 |
| 695 error_screen_actor_->Hide(); | 699 error_screen_actor_->Hide(); |
| 700 histogram_helper_->OnErrorHide(); |
| 696 | 701 |
| 697 // Forces a reload for Gaia screen on hiding error message. | 702 // Forces a reload for Gaia screen on hiding error message. |
| 698 if (IsGaiaVisible() || IsGaiaHiddenByError()) | 703 if (IsGaiaVisible() || IsGaiaHiddenByError()) |
| 699 ReloadGaia(false); | 704 ReloadGaia(false); |
| 700 } | 705 } |
| 701 | 706 |
| 702 void SigninScreenHandler::ReloadGaia(bool force_reload) { | 707 void SigninScreenHandler::ReloadGaia(bool force_reload) { |
| 703 gaia_screen_handler_->ReloadGaia(force_reload); | 708 gaia_screen_handler_->ReloadGaia(force_reload); |
| 704 } | 709 } |
| 705 | 710 |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 return gaia_screen_handler_->frame_error(); | 1491 return gaia_screen_handler_->frame_error(); |
| 1487 } | 1492 } |
| 1488 | 1493 |
| 1489 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1494 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1490 caps_lock_enabled_ = enabled; | 1495 caps_lock_enabled_ = enabled; |
| 1491 if (page_is_ready()) | 1496 if (page_is_ready()) |
| 1492 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1497 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1493 } | 1498 } |
| 1494 | 1499 |
| 1495 } // namespace chromeos | 1500 } // namespace chromeos |
| OLD | NEW |