| 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 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" | 19 #include "chrome/browser/chromeos/login/screens/network_error_model.h" |
| 20 #include "chrome/browser/chromeos/login/signin_specifics.h" | 20 #include "chrome/browser/chromeos/login/signin_specifics.h" |
| 21 #include "chrome/browser/chromeos/login/ui/login_display.h" | 21 #include "chrome/browser/chromeos/login/ui/login_display.h" |
| 22 #include "chrome/browser/chromeos/settings/cros_settings.h" | 22 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 23 #include "chrome/browser/signin/screenlock_bridge.h" | 23 #include "chrome/browser/signin/screenlock_bridge.h" |
| 24 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 24 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 25 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" | |
| 26 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 25 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
| 27 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 26 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 28 #include "chrome/browser/ui/webui/chromeos/touch_view_controller_delegate.h" | 27 #include "chrome/browser/ui/webui/chromeos/touch_view_controller_delegate.h" |
| 29 #include "chromeos/network/portal_detector/network_portal_detector.h" | 28 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 30 #include "components/user_manager/user_manager.h" | 29 #include "components/user_manager/user_manager.h" |
| 31 #include "content/public/browser/notification_observer.h" | 30 #include "content/public/browser/notification_observer.h" |
| 32 #include "content/public/browser/notification_registrar.h" | 31 #include "content/public/browser/notification_registrar.h" |
| 33 #include "content/public/browser/web_ui.h" | 32 #include "content/public/browser/web_ui.h" |
| 34 #include "net/base/net_errors.h" | 33 #include "net/base/net_errors.h" |
| 35 #include "ui/base/ime/chromeos/ime_keyboard.h" | 34 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 : public BaseScreenHandler, | 198 : public BaseScreenHandler, |
| 200 public LoginDisplayWebUIHandler, | 199 public LoginDisplayWebUIHandler, |
| 201 public content::NotificationObserver, | 200 public content::NotificationObserver, |
| 202 public NetworkStateInformer::NetworkStateInformerObserver, | 201 public NetworkStateInformer::NetworkStateInformerObserver, |
| 203 public input_method::ImeKeyboard::Observer, | 202 public input_method::ImeKeyboard::Observer, |
| 204 public TouchViewControllerDelegate::Observer, | 203 public TouchViewControllerDelegate::Observer, |
| 205 public OobeUI::Observer { | 204 public OobeUI::Observer { |
| 206 public: | 205 public: |
| 207 SigninScreenHandler( | 206 SigninScreenHandler( |
| 208 const scoped_refptr<NetworkStateInformer>& network_state_informer, | 207 const scoped_refptr<NetworkStateInformer>& network_state_informer, |
| 209 ErrorScreenActor* error_screen_actor, | 208 NetworkErrorModel* network_error_model, |
| 210 CoreOobeActor* core_oobe_actor, | 209 CoreOobeActor* core_oobe_actor, |
| 211 GaiaScreenHandler* gaia_screen_handler); | 210 GaiaScreenHandler* gaia_screen_handler); |
| 212 ~SigninScreenHandler() override; | 211 ~SigninScreenHandler() override; |
| 213 | 212 |
| 214 static std::string GetUserLRUInputMethod(const std::string& username); | 213 static std::string GetUserLRUInputMethod(const std::string& username); |
| 215 | 214 |
| 216 // Update current input method (namely keyboard layout) in the given IME state | 215 // Update current input method (namely keyboard layout) in the given IME state |
| 217 // to LRU by this user. | 216 // to LRU by this user. |
| 218 static void SetUserInputMethod( | 217 static void SetUserInputMethod( |
| 219 const std::string& username, | 218 const std::string& username, |
| 220 input_method::InputMethodManager::State* ime_state); | 219 input_method::InputMethodManager::State* ime_state); |
| 221 | 220 |
| 222 // Shows the sign in screen. | 221 // Shows the sign in screen. |
| 223 void Show(const LoginScreenContext& context); | 222 void Show(const LoginScreenContext& context); |
| 224 | 223 |
| 225 // Sets delegate to be used by the handler. It is guaranteed that valid | 224 // Sets delegate to be used by the handler. It is guaranteed that valid |
| 226 // delegate is set before Show() method will be called. | 225 // delegate is set before Show() method will be called. |
| 227 void SetDelegate(SigninScreenHandlerDelegate* delegate); | 226 void SetDelegate(SigninScreenHandlerDelegate* delegate); |
| 228 | 227 |
| 229 void SetNativeWindowDelegate(NativeWindowDelegate* native_window_delegate); | 228 void SetNativeWindowDelegate(NativeWindowDelegate* native_window_delegate); |
| 230 | 229 |
| 231 // NetworkStateInformer::NetworkStateInformerObserver implementation: | 230 // NetworkStateInformer::NetworkStateInformerObserver implementation: |
| 232 void OnNetworkReady() override; | 231 void OnNetworkReady() override; |
| 233 void UpdateState(ErrorScreenActor::ErrorReason reason) override; | 232 void UpdateState(NetworkError::ErrorReason reason) override; |
| 234 | 233 |
| 235 // Required Local State preferences. | 234 // Required Local State preferences. |
| 236 static void RegisterPrefs(PrefRegistrySimple* registry); | 235 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 237 | 236 |
| 238 // OobeUI::Observer implemetation. | 237 // OobeUI::Observer implemetation. |
| 239 void OnCurrentScreenChanged(OobeUI::Screen current_screen, | 238 void OnCurrentScreenChanged(OobeUI::Screen current_screen, |
| 240 OobeUI::Screen new_screen) override; | 239 OobeUI::Screen new_screen) override; |
| 241 | 240 |
| 242 void SetFocusPODCallbackForTesting(base::Closure callback); | 241 void SetFocusPODCallbackForTesting(base::Closure callback); |
| 243 | 242 |
| 244 private: | 243 private: |
| 245 enum UIState { | 244 enum UIState { |
| 246 UI_STATE_UNKNOWN = 0, | 245 UI_STATE_UNKNOWN = 0, |
| 247 UI_STATE_GAIA_SIGNIN, | 246 UI_STATE_GAIA_SIGNIN, |
| 248 UI_STATE_ACCOUNT_PICKER, | 247 UI_STATE_ACCOUNT_PICKER, |
| 249 }; | 248 }; |
| 250 | 249 |
| 251 friend class GaiaScreenHandler; | 250 friend class GaiaScreenHandler; |
| 252 friend class ReportDnsCacheClearedOnUIThread; | 251 friend class ReportDnsCacheClearedOnUIThread; |
| 253 friend class SupervisedUserCreationScreenHandler; | 252 friend class SupervisedUserCreationScreenHandler; |
| 254 | 253 |
| 255 void ShowImpl(); | 254 void ShowImpl(); |
| 256 | 255 |
| 257 // Updates current UI of the signin screen according to |ui_state| | 256 // Updates current UI of the signin screen according to |ui_state| |
| 258 // argument. Optionally it can pass screen initialization data via | 257 // argument. Optionally it can pass screen initialization data via |
| 259 // |params| argument. | 258 // |params| argument. |
| 260 void UpdateUIState(UIState ui_state, base::DictionaryValue* params); | 259 void UpdateUIState(UIState ui_state, base::DictionaryValue* params); |
| 261 | 260 |
| 262 void UpdateStateInternal(ErrorScreenActor::ErrorReason reason, | 261 void UpdateStateInternal(NetworkError::ErrorReason reason, bool force_update); |
| 263 bool force_update); | |
| 264 void SetupAndShowOfflineMessage(NetworkStateInformer::State state, | 262 void SetupAndShowOfflineMessage(NetworkStateInformer::State state, |
| 265 ErrorScreenActor::ErrorReason reason); | 263 NetworkError::ErrorReason reason); |
| 266 void HideOfflineMessage(NetworkStateInformer::State state, | 264 void HideOfflineMessage(NetworkStateInformer::State state, |
| 267 ErrorScreenActor::ErrorReason reason); | 265 NetworkError::ErrorReason reason); |
| 268 void ReloadGaia(bool force_reload); | 266 void ReloadGaia(bool force_reload); |
| 269 | 267 |
| 270 // BaseScreenHandler implementation: | 268 // BaseScreenHandler implementation: |
| 271 void DeclareLocalizedValues(LocalizedValuesBuilder* builder) override; | 269 void DeclareLocalizedValues(LocalizedValuesBuilder* builder) override; |
| 272 void Initialize() override; | 270 void Initialize() override; |
| 273 gfx::NativeWindow GetNativeWindow() override; | 271 gfx::NativeWindow GetNativeWindow() override; |
| 274 | 272 |
| 275 // WebUIMessageHandler implementation: | 273 // WebUIMessageHandler implementation: |
| 276 void RegisterMessages() override; | 274 void RegisterMessages() override; |
| 277 | 275 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 bool IsGuestSigninAllowed() const; | 388 bool IsGuestSigninAllowed() const; |
| 391 | 389 |
| 392 // Returns true if offline login is allowed. | 390 // Returns true if offline login is allowed. |
| 393 bool IsOfflineLoginAllowed() const; | 391 bool IsOfflineLoginAllowed() const; |
| 394 | 392 |
| 395 bool ShouldLoadGaia() const; | 393 bool ShouldLoadGaia() const; |
| 396 | 394 |
| 397 // Shows signin. | 395 // Shows signin. |
| 398 void OnShowAddUser(); | 396 void OnShowAddUser(); |
| 399 | 397 |
| 400 GaiaScreenHandler::FrameState FrameState() const; | |
| 401 net::Error FrameError() const; | 398 net::Error FrameError() const; |
| 402 | 399 |
| 403 // input_method::ImeKeyboard::Observer implementation: | 400 // input_method::ImeKeyboard::Observer implementation: |
| 404 void OnCapsLockChanged(bool enabled) override; | 401 void OnCapsLockChanged(bool enabled) override; |
| 405 | 402 |
| 406 // Returns OobeUI object of NULL. | 403 // Returns OobeUI object of NULL. |
| 407 OobeUI* GetOobeUI() const; | 404 OobeUI* GetOobeUI() const; |
| 408 | 405 |
| 409 // Gets the easy unlock service associated with the user. Can return NULL if | 406 // Gets the easy unlock service associated with the user. Can return NULL if |
| 410 // user cannot be found, or there is not associated service. | 407 // user cannot be found, or there is not associated service. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 429 // Is account picker being shown for the first time. | 426 // Is account picker being shown for the first time. |
| 430 bool is_account_picker_showing_first_time_; | 427 bool is_account_picker_showing_first_time_; |
| 431 | 428 |
| 432 // Network state informer used to keep signin screen up. | 429 // Network state informer used to keep signin screen up. |
| 433 scoped_refptr<NetworkStateInformer> network_state_informer_; | 430 scoped_refptr<NetworkStateInformer> network_state_informer_; |
| 434 | 431 |
| 435 // Set to true once |LOGIN_WEBUI_VISIBLE| notification is observed. | 432 // Set to true once |LOGIN_WEBUI_VISIBLE| notification is observed. |
| 436 bool webui_visible_; | 433 bool webui_visible_; |
| 437 bool preferences_changed_delayed_; | 434 bool preferences_changed_delayed_; |
| 438 | 435 |
| 439 ErrorScreenActor* error_screen_actor_; | 436 NetworkErrorModel* network_error_model_; |
| 440 CoreOobeActor* core_oobe_actor_; | 437 CoreOobeActor* core_oobe_actor_; |
| 441 | 438 |
| 442 bool is_first_update_state_call_; | 439 bool is_first_update_state_call_; |
| 443 bool offline_login_active_; | 440 bool offline_login_active_; |
| 444 NetworkStateInformer::State last_network_state_; | 441 NetworkStateInformer::State last_network_state_; |
| 445 | 442 |
| 446 base::CancelableClosure update_state_closure_; | 443 base::CancelableClosure update_state_closure_; |
| 447 base::CancelableClosure connecting_closure_; | 444 base::CancelableClosure connecting_closure_; |
| 448 | 445 |
| 449 content::NotificationRegistrar registrar_; | 446 content::NotificationRegistrar registrar_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 477 scoped_ptr<ErrorScreensHistogramHelper> histogram_helper_; | 474 scoped_ptr<ErrorScreensHistogramHelper> histogram_helper_; |
| 478 | 475 |
| 479 base::WeakPtrFactory<SigninScreenHandler> weak_factory_; | 476 base::WeakPtrFactory<SigninScreenHandler> weak_factory_; |
| 480 | 477 |
| 481 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); | 478 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); |
| 482 }; | 479 }; |
| 483 | 480 |
| 484 } // namespace chromeos | 481 } // namespace chromeos |
| 485 | 482 |
| 486 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 483 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
| OLD | NEW |