Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc

Issue 872633008: Migrate (Network)ErrorScreen to ScreenContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/login/localized_values_builder.h" 35 #include "components/login/localized_values_builder.h"
34 #include "components/user_manager/user_manager.h" 36 #include "components/user_manager/user_manager.h"
35 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
36 #include "content/public/browser/render_frame_host.h" 38 #include "content/public/browser/render_frame_host.h"
37 #include "google_apis/gaia/gaia_auth_util.h" 39 #include "google_apis/gaia/gaia_auth_util.h"
38 #include "google_apis/gaia/gaia_switches.h" 40 #include "google_apis/gaia/gaia_switches.h"
39 #include "google_apis/gaia/gaia_urls.h" 41 #include "google_apis/gaia/gaia_urls.h"
40 #include "ui/base/ime/chromeos/input_method_manager.h" 42 #include "ui/base/ime/chromeos/input_method_manager.h"
41 #include "ui/base/l10n/l10n_util.h" 43 #include "ui/base/l10n/l10n_util.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 VLOG(1) << "Gaia is loaded"; 342 VLOG(1) << "Gaia is loaded";
341 frame_state_ = FRAME_STATE_LOADED; 343 frame_state_ = FRAME_STATE_LOADED;
342 } else { 344 } else {
343 LOG(WARNING) << "Gaia frame error: " << frame_error_; 345 LOG(WARNING) << "Gaia frame error: " << frame_error_;
344 frame_state_ = FRAME_STATE_ERROR; 346 frame_state_ = FRAME_STATE_ERROR;
345 } 347 }
346 348
347 if (network_state_informer_->state() != NetworkStateInformer::ONLINE) 349 if (network_state_informer_->state() != NetworkStateInformer::ONLINE)
348 return; 350 return;
349 if (frame_state_ == FRAME_STATE_LOADED) 351 if (frame_state_ == FRAME_STATE_LOADED)
350 UpdateState(ErrorScreenActor::ERROR_REASON_UPDATE); 352 UpdateState(NetworkError::ERROR_REASON_UPDATE);
351 else if (frame_state_ == FRAME_STATE_ERROR) 353 else if (frame_state_ == FRAME_STATE_ERROR)
352 UpdateState(ErrorScreenActor::ERROR_REASON_FRAME_ERROR); 354 UpdateState(NetworkError::ERROR_REASON_FRAME_ERROR);
353 } 355 }
354 356
355 void GaiaScreenHandler::HandleCompleteAuthentication( 357 void GaiaScreenHandler::HandleCompleteAuthentication(
356 const std::string& gaia_id, 358 const std::string& gaia_id,
357 const std::string& email, 359 const std::string& email,
358 const std::string& password, 360 const std::string& password,
359 const std::string& auth_code) { 361 const std::string& auth_code) {
360 if (!Delegate()) 362 if (!Delegate())
361 return; 363 return;
362 364
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 signin_screen_handler_->UpdateUIState( 691 signin_screen_handler_->UpdateUIState(
690 SigninScreenHandler::UI_STATE_GAIA_SIGNIN, NULL); 692 SigninScreenHandler::UI_STATE_GAIA_SIGNIN, NULL);
691 693
692 if (gaia_silent_load_) { 694 if (gaia_silent_load_) {
693 // The variable is assigned to false because silently loaded Gaia page was 695 // The variable is assigned to false because silently loaded Gaia page was
694 // used. 696 // used.
695 gaia_silent_load_ = false; 697 gaia_silent_load_ = false;
696 if (focus_stolen_) 698 if (focus_stolen_)
697 HandleGaiaUIReady(); 699 HandleGaiaUIReady();
698 } 700 }
699 signin_screen_handler_->UpdateState(ErrorScreenActor::ERROR_REASON_UPDATE); 701 signin_screen_handler_->UpdateState(NetworkError::ERROR_REASON_UPDATE);
700 702
701 if (core_oobe_actor_) { 703 if (core_oobe_actor_) {
702 PrefService* prefs = g_browser_process->local_state(); 704 PrefService* prefs = g_browser_process->local_state();
703 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { 705 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) {
704 core_oobe_actor_->ShowDeviceResetScreen(); 706 core_oobe_actor_->ShowDeviceResetScreen();
705 } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) { 707 } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) {
706 core_oobe_actor_->ShowEnableDebuggingScreen(); 708 core_oobe_actor_->ShowEnableDebuggingScreen();
707 } 709 }
708 } 710 }
709 } 711 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 context.embedded_signin_enabled = 745 context.embedded_signin_enabled =
744 base::CommandLine::ForCurrentProcess()->HasSwitch( 746 base::CommandLine::ForCurrentProcess()->HasSwitch(
745 chromeos::switches::kEnableEmbeddedSignin) || 747 chromeos::switches::kEnableEmbeddedSignin) ||
746 embedded_signin_enabled_by_shortcut_; 748 embedded_signin_enabled_by_shortcut_;
747 749
748 populated_email_.clear(); 750 populated_email_.clear();
749 751
750 LoadGaia(context); 752 LoadGaia(context);
751 } 753 }
752 754
753 void GaiaScreenHandler::UpdateState(ErrorScreenActor::ErrorReason reason) { 755 void GaiaScreenHandler::UpdateState(NetworkError::ErrorReason reason) {
754 if (signin_screen_handler_) 756 if (signin_screen_handler_)
755 signin_screen_handler_->UpdateState(reason); 757 signin_screen_handler_->UpdateState(reason);
756 } 758 }
757 759
758 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { 760 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() {
759 DCHECK(signin_screen_handler_); 761 DCHECK(signin_screen_handler_);
760 return signin_screen_handler_->delegate_; 762 return signin_screen_handler_->delegate_;
761 } 763 }
762 764
763 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { 765 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) {
764 signin_screen_handler_ = handler; 766 signin_screen_handler_ = handler;
765 } 767 }
766 } // namespace chromeos 768 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698