| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/gaia_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browser_shutdown.h" | 14 #include "chrome/browser/browser_shutdown.h" |
| 15 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 15 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 16 #include "chrome/browser/chromeos/language_preferences.h" | 16 #include "chrome/browser/chromeos/language_preferences.h" |
| 17 #include "chrome/browser/chromeos/login/screens/network_error.h" |
| 17 #include "chrome/browser/chromeos/login/startup_utils.h" | 18 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 18 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 19 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 19 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 20 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 20 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 21 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| 21 #include "chrome/browser/chromeos/policy/consumer_management_stage.h" | 22 #include "chrome/browser/chromeos/policy/consumer_management_stage.h" |
| 22 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 23 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 23 #include "chrome/browser/chromeos/settings/cros_settings.h" | 24 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 24 #include "chrome/browser/io_thread.h" | 25 #include "chrome/browser/io_thread.h" |
| 25 #include "chrome/browser/lifetime/application_lifetime.h" | 26 #include "chrome/browser/lifetime/application_lifetime.h" |
| 26 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 27 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 27 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" | 28 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" |
| 28 #include "chrome/common/chrome_version_info.h" | 29 #include "chrome/common/chrome_version_info.h" |
| 29 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/grit/generated_resources.h" | 31 #include "chrome/grit/generated_resources.h" |
| 31 #include "chromeos/chromeos_switches.h" | 32 #include "chromeos/chromeos_switches.h" |
| 33 #include "chromeos/login/auth/user_context.h" |
| 32 #include "chromeos/settings/cros_settings_names.h" | 34 #include "chromeos/settings/cros_settings_names.h" |
| 33 #include "components/user_manager/user_manager.h" | 35 #include "components/user_manager/user_manager.h" |
| 34 #include "content/public/browser/browser_thread.h" | 36 #include "content/public/browser/browser_thread.h" |
| 35 #include "content/public/browser/render_frame_host.h" | 37 #include "content/public/browser/render_frame_host.h" |
| 36 #include "google_apis/gaia/gaia_auth_util.h" | 38 #include "google_apis/gaia/gaia_auth_util.h" |
| 37 #include "google_apis/gaia/gaia_switches.h" | 39 #include "google_apis/gaia/gaia_switches.h" |
| 38 #include "google_apis/gaia/gaia_urls.h" | 40 #include "google_apis/gaia/gaia_urls.h" |
| 39 #include "ui/base/ime/chromeos/input_method_manager.h" | 41 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 40 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
| 41 | 43 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 VLOG(1) << "Gaia is loaded"; | 341 VLOG(1) << "Gaia is loaded"; |
| 340 frame_state_ = FRAME_STATE_LOADED; | 342 frame_state_ = FRAME_STATE_LOADED; |
| 341 } else { | 343 } else { |
| 342 LOG(WARNING) << "Gaia frame error: " << frame_error_; | 344 LOG(WARNING) << "Gaia frame error: " << frame_error_; |
| 343 frame_state_ = FRAME_STATE_ERROR; | 345 frame_state_ = FRAME_STATE_ERROR; |
| 344 } | 346 } |
| 345 | 347 |
| 346 if (network_state_informer_->state() != NetworkStateInformer::ONLINE) | 348 if (network_state_informer_->state() != NetworkStateInformer::ONLINE) |
| 347 return; | 349 return; |
| 348 if (frame_state_ == FRAME_STATE_LOADED) | 350 if (frame_state_ == FRAME_STATE_LOADED) |
| 349 UpdateState(ErrorScreenActor::ERROR_REASON_UPDATE); | 351 UpdateState(NetworkError::ERROR_REASON_UPDATE); |
| 350 else if (frame_state_ == FRAME_STATE_ERROR) | 352 else if (frame_state_ == FRAME_STATE_ERROR) |
| 351 UpdateState(ErrorScreenActor::ERROR_REASON_FRAME_ERROR); | 353 UpdateState(NetworkError::ERROR_REASON_FRAME_ERROR); |
| 352 } | 354 } |
| 353 | 355 |
| 354 void GaiaScreenHandler::HandleCompleteAuthentication( | 356 void GaiaScreenHandler::HandleCompleteAuthentication( |
| 355 const std::string& gaia_id, | 357 const std::string& gaia_id, |
| 356 const std::string& email, | 358 const std::string& email, |
| 357 const std::string& password, | 359 const std::string& password, |
| 358 const std::string& auth_code) { | 360 const std::string& auth_code) { |
| 359 if (!Delegate()) | 361 if (!Delegate()) |
| 360 return; | 362 return; |
| 361 | 363 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 signin_screen_handler_->UpdateUIState( | 690 signin_screen_handler_->UpdateUIState( |
| 689 SigninScreenHandler::UI_STATE_GAIA_SIGNIN, NULL); | 691 SigninScreenHandler::UI_STATE_GAIA_SIGNIN, NULL); |
| 690 | 692 |
| 691 if (gaia_silent_load_) { | 693 if (gaia_silent_load_) { |
| 692 // The variable is assigned to false because silently loaded Gaia page was | 694 // The variable is assigned to false because silently loaded Gaia page was |
| 693 // used. | 695 // used. |
| 694 gaia_silent_load_ = false; | 696 gaia_silent_load_ = false; |
| 695 if (focus_stolen_) | 697 if (focus_stolen_) |
| 696 HandleGaiaUIReady(); | 698 HandleGaiaUIReady(); |
| 697 } | 699 } |
| 698 signin_screen_handler_->UpdateState(ErrorScreenActor::ERROR_REASON_UPDATE); | 700 signin_screen_handler_->UpdateState(NetworkError::ERROR_REASON_UPDATE); |
| 699 | 701 |
| 700 if (core_oobe_actor_) { | 702 if (core_oobe_actor_) { |
| 701 PrefService* prefs = g_browser_process->local_state(); | 703 PrefService* prefs = g_browser_process->local_state(); |
| 702 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { | 704 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { |
| 703 core_oobe_actor_->ShowDeviceResetScreen(); | 705 core_oobe_actor_->ShowDeviceResetScreen(); |
| 704 } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) { | 706 } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) { |
| 705 core_oobe_actor_->ShowEnableDebuggingScreen(); | 707 core_oobe_actor_->ShowEnableDebuggingScreen(); |
| 706 } | 708 } |
| 707 } | 709 } |
| 708 } | 710 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 context.embedded_signin_enabled = | 744 context.embedded_signin_enabled = |
| 743 base::CommandLine::ForCurrentProcess()->HasSwitch( | 745 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 744 chromeos::switches::kEnableEmbeddedSignin) || | 746 chromeos::switches::kEnableEmbeddedSignin) || |
| 745 embedded_signin_enabled_by_shortcut_; | 747 embedded_signin_enabled_by_shortcut_; |
| 746 | 748 |
| 747 populated_email_.clear(); | 749 populated_email_.clear(); |
| 748 | 750 |
| 749 LoadGaia(context); | 751 LoadGaia(context); |
| 750 } | 752 } |
| 751 | 753 |
| 752 void GaiaScreenHandler::UpdateState(ErrorScreenActor::ErrorReason reason) { | 754 void GaiaScreenHandler::UpdateState(NetworkError::ErrorReason reason) { |
| 753 if (signin_screen_handler_) | 755 if (signin_screen_handler_) |
| 754 signin_screen_handler_->UpdateState(reason); | 756 signin_screen_handler_->UpdateState(reason); |
| 755 } | 757 } |
| 756 | 758 |
| 757 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 759 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
| 758 DCHECK(signin_screen_handler_); | 760 DCHECK(signin_screen_handler_); |
| 759 return signin_screen_handler_->delegate_; | 761 return signin_screen_handler_->delegate_; |
| 760 } | 762 } |
| 761 | 763 |
| 762 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 764 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
| 763 signin_screen_handler_ = handler; | 765 signin_screen_handler_ = handler; |
| 764 } | 766 } |
| 765 } // namespace chromeos | 767 } // namespace chromeos |
| OLD | NEW |