| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 core_oobe_actor_(core_oobe_actor), | 249 core_oobe_actor_(core_oobe_actor), |
| 249 is_first_update_state_call_(true), | 250 is_first_update_state_call_(true), |
| 250 offline_login_active_(false), | 251 offline_login_active_(false), |
| 251 last_network_state_(NetworkStateInformer::UNKNOWN), | 252 last_network_state_(NetworkStateInformer::UNKNOWN), |
| 252 has_pending_auth_ui_(false), | 253 has_pending_auth_ui_(false), |
| 253 caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get() | 254 caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get() |
| 254 ->GetImeKeyboard() | 255 ->GetImeKeyboard() |
| 255 ->CapsLockIsEnabled()), | 256 ->CapsLockIsEnabled()), |
| 256 gaia_screen_handler_(gaia_screen_handler), | 257 gaia_screen_handler_(gaia_screen_handler), |
| 257 oobe_ui_observer_added_(false), | 258 oobe_ui_observer_added_(false), |
| 259 histogram_helper_(new ErrorScreensHistogramHelper("Signin")), |
| 258 weak_factory_(this) { | 260 weak_factory_(this) { |
| 259 DCHECK(network_state_informer_.get()); | 261 DCHECK(network_state_informer_.get()); |
| 260 DCHECK(error_screen_actor_); | 262 DCHECK(error_screen_actor_); |
| 261 DCHECK(core_oobe_actor_); | 263 DCHECK(core_oobe_actor_); |
| 262 DCHECK(gaia_screen_handler_); | 264 DCHECK(gaia_screen_handler_); |
| 263 gaia_screen_handler_->SetSigninScreenHandler(this); | 265 gaia_screen_handler_->SetSigninScreenHandler(this); |
| 264 network_state_informer_->AddObserver(this); | 266 network_state_informer_->AddObserver(this); |
| 265 | 267 |
| 266 registrar_.Add(this, | 268 registrar_.Add(this, |
| 267 chrome::NOTIFICATION_AUTH_NEEDED, | 269 chrome::NOTIFICATION_AUTH_NEEDED, |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 if (is_enrolling_consumer_management_) { | 426 if (is_enrolling_consumer_management_) { |
| 425 // We don't check if the value of the owner e-mail is trusted because it is | 427 // We don't check if the value of the owner e-mail is trusted because it is |
| 426 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached | 428 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached |
| 427 // value is sufficient. | 429 // value is sufficient. |
| 428 CrosSettings::Get()->GetString(kDeviceOwner, &email); | 430 CrosSettings::Get()->GetString(kDeviceOwner, &email); |
| 429 } else { | 431 } else { |
| 430 email = context.email(); | 432 email = context.email(); |
| 431 } | 433 } |
| 432 gaia_screen_handler_->PopulateEmail(email); | 434 gaia_screen_handler_->PopulateEmail(email); |
| 433 ShowImpl(); | 435 ShowImpl(); |
| 436 histogram_helper_->OnScreenShow(); |
| 434 } | 437 } |
| 435 | 438 |
| 436 void SigninScreenHandler::ShowRetailModeLoginSpinner() { | 439 void SigninScreenHandler::ShowRetailModeLoginSpinner() { |
| 437 CallJS("showLoginSpinner"); | 440 CallJS("showLoginSpinner"); |
| 438 } | 441 } |
| 439 | 442 |
| 440 void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) { | 443 void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) { |
| 441 delegate_ = delegate; | 444 delegate_ = delegate; |
| 442 if (delegate_) | 445 if (delegate_) |
| 443 delegate_->SetWebUIHandler(this); | 446 delegate_->SetWebUIHandler(this); |
| (...skipping 237 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 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 return gaia_screen_handler_->frame_error(); | 1606 return gaia_screen_handler_->frame_error(); |
| 1602 } | 1607 } |
| 1603 | 1608 |
| 1604 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1609 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1605 caps_lock_enabled_ = enabled; | 1610 caps_lock_enabled_ = enabled; |
| 1606 if (page_is_ready()) | 1611 if (page_is_ready()) |
| 1607 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1612 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1608 } | 1613 } |
| 1609 | 1614 |
| 1610 } // namespace chromeos | 1615 } // namespace chromeos |
| OLD | NEW |