| 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" | |
| 33 #include "chrome/browser/chromeos/login/hwid_checker.h" | 32 #include "chrome/browser/chromeos/login/hwid_checker.h" |
| 34 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 33 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 35 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 34 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
| 36 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 35 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 37 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 36 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 38 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 37 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 39 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 38 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 40 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 39 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 41 #include "chrome/browser/chromeos/login/wizard_controller.h" | 40 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 42 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 41 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 core_oobe_actor_(core_oobe_actor), | 248 core_oobe_actor_(core_oobe_actor), |
| 250 is_first_update_state_call_(true), | 249 is_first_update_state_call_(true), |
| 251 offline_login_active_(false), | 250 offline_login_active_(false), |
| 252 last_network_state_(NetworkStateInformer::UNKNOWN), | 251 last_network_state_(NetworkStateInformer::UNKNOWN), |
| 253 has_pending_auth_ui_(false), | 252 has_pending_auth_ui_(false), |
| 254 caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get() | 253 caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get() |
| 255 ->GetImeKeyboard() | 254 ->GetImeKeyboard() |
| 256 ->CapsLockIsEnabled()), | 255 ->CapsLockIsEnabled()), |
| 257 gaia_screen_handler_(gaia_screen_handler), | 256 gaia_screen_handler_(gaia_screen_handler), |
| 258 oobe_ui_observer_added_(false), | 257 oobe_ui_observer_added_(false), |
| 259 histogram_helper_(new ErrorScreensHistogramHelper("Signin")), | |
| 260 weak_factory_(this) { | 258 weak_factory_(this) { |
| 261 DCHECK(network_state_informer_.get()); | 259 DCHECK(network_state_informer_.get()); |
| 262 DCHECK(error_screen_actor_); | 260 DCHECK(error_screen_actor_); |
| 263 DCHECK(core_oobe_actor_); | 261 DCHECK(core_oobe_actor_); |
| 264 DCHECK(gaia_screen_handler_); | 262 DCHECK(gaia_screen_handler_); |
| 265 gaia_screen_handler_->SetSigninScreenHandler(this); | 263 gaia_screen_handler_->SetSigninScreenHandler(this); |
| 266 network_state_informer_->AddObserver(this); | 264 network_state_informer_->AddObserver(this); |
| 267 | 265 |
| 268 registrar_.Add(this, | 266 registrar_.Add(this, |
| 269 chrome::NOTIFICATION_AUTH_NEEDED, | 267 chrome::NOTIFICATION_AUTH_NEEDED, |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 if (is_enrolling_consumer_management_) { | 424 if (is_enrolling_consumer_management_) { |
| 427 // We don't check if the value of the owner e-mail is trusted because it is | 425 // We don't check if the value of the owner e-mail is trusted because it is |
| 428 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached | 426 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached |
| 429 // value is sufficient. | 427 // value is sufficient. |
| 430 CrosSettings::Get()->GetString(kDeviceOwner, &email); | 428 CrosSettings::Get()->GetString(kDeviceOwner, &email); |
| 431 } else { | 429 } else { |
| 432 email = context.email(); | 430 email = context.email(); |
| 433 } | 431 } |
| 434 gaia_screen_handler_->PopulateEmail(email); | 432 gaia_screen_handler_->PopulateEmail(email); |
| 435 ShowImpl(); | 433 ShowImpl(); |
| 436 histogram_helper_->OnScreenShow(); | |
| 437 } | 434 } |
| 438 | 435 |
| 439 void SigninScreenHandler::ShowRetailModeLoginSpinner() { | 436 void SigninScreenHandler::ShowRetailModeLoginSpinner() { |
| 440 CallJS("showLoginSpinner"); | 437 CallJS("showLoginSpinner"); |
| 441 } | 438 } |
| 442 | 439 |
| 443 void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) { | 440 void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) { |
| 444 delegate_ = delegate; | 441 delegate_ = delegate; |
| 445 if (delegate_) | 442 if (delegate_) |
| 446 delegate_->SetWebUIHandler(this); | 443 delegate_->SetWebUIHandler(this); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 error_screen_actor_->error_state() != | 681 error_screen_actor_->error_state() != |
| 685 ErrorScreen::ERROR_STATE_AUTH_EXT_TIMEOUT; | 682 ErrorScreen::ERROR_STATE_AUTH_EXT_TIMEOUT; |
| 686 error_screen_actor_->AllowOfflineLogin(offline_login_allowed); | 683 error_screen_actor_->AllowOfflineLogin(offline_login_allowed); |
| 687 | 684 |
| 688 if (GetCurrentScreen() != OobeUI::SCREEN_ERROR_MESSAGE) { | 685 if (GetCurrentScreen() != OobeUI::SCREEN_ERROR_MESSAGE) { |
| 689 base::DictionaryValue params; | 686 base::DictionaryValue params; |
| 690 const std::string network_type = network_state_informer_->network_type(); | 687 const std::string network_type = network_state_informer_->network_type(); |
| 691 params.SetString("lastNetworkType", network_type); | 688 params.SetString("lastNetworkType", network_type); |
| 692 error_screen_actor_->SetUIState(ErrorScreen::UI_STATE_SIGNIN); | 689 error_screen_actor_->SetUIState(ErrorScreen::UI_STATE_SIGNIN); |
| 693 error_screen_actor_->Show(OobeUI::SCREEN_GAIA_SIGNIN, ¶ms); | 690 error_screen_actor_->Show(OobeUI::SCREEN_GAIA_SIGNIN, ¶ms); |
| 694 histogram_helper_->OnErrorShow(error_screen_actor_->error_state()); | |
| 695 } | 691 } |
| 696 } | 692 } |
| 697 | 693 |
| 698 void SigninScreenHandler::HideOfflineMessage( | 694 void SigninScreenHandler::HideOfflineMessage( |
| 699 NetworkStateInformer::State state, | 695 NetworkStateInformer::State state, |
| 700 ErrorScreenActor::ErrorReason reason) { | 696 ErrorScreenActor::ErrorReason reason) { |
| 701 if (!IsSigninScreenHiddenByError()) | 697 if (!IsSigninScreenHiddenByError()) |
| 702 return; | 698 return; |
| 703 | 699 |
| 704 error_screen_actor_->Hide(); | 700 error_screen_actor_->Hide(); |
| 705 histogram_helper_->OnErrorHide(); | |
| 706 | 701 |
| 707 // Forces a reload for Gaia screen on hiding error message. | 702 // Forces a reload for Gaia screen on hiding error message. |
| 708 if (IsGaiaVisible() || IsGaiaHiddenByError()) | 703 if (IsGaiaVisible() || IsGaiaHiddenByError()) |
| 709 ReloadGaia(false); | 704 ReloadGaia(false); |
| 710 } | 705 } |
| 711 | 706 |
| 712 void SigninScreenHandler::ReloadGaia(bool force_reload) { | 707 void SigninScreenHandler::ReloadGaia(bool force_reload) { |
| 713 gaia_screen_handler_->ReloadGaia(force_reload); | 708 gaia_screen_handler_->ReloadGaia(force_reload); |
| 714 } | 709 } |
| 715 | 710 |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 return gaia_screen_handler_->frame_error(); | 1573 return gaia_screen_handler_->frame_error(); |
| 1579 } | 1574 } |
| 1580 | 1575 |
| 1581 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1576 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1582 caps_lock_enabled_ = enabled; | 1577 caps_lock_enabled_ = enabled; |
| 1583 if (page_is_ready()) | 1578 if (page_is_ready()) |
| 1584 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1579 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1585 } | 1580 } |
| 1586 | 1581 |
| 1587 } // namespace chromeos | 1582 } // namespace chromeos |
| OLD | NEW |