| 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/chromeos/login/signin_specifics.h" | 21 #include "chrome/browser/chromeos/login/signin_specifics.h" |
| 22 #include "chrome/browser/chromeos/login/ui/login_display.h" | 22 #include "chrome/browser/chromeos/login/ui/login_display.h" |
| 23 #include "chrome/browser/chromeos/settings/cros_settings.h" | 23 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 24 #include "chrome/browser/signin/screenlock_bridge.h" | 24 #include "chrome/browser/signin/screenlock_bridge.h" |
| 25 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 25 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 26 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" | 26 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" |
| 27 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 27 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
| 28 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 28 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 29 #include "chrome/browser/ui/webui/chromeos/touch_view_controller_delegate.h" | 29 #include "chrome/browser/ui/webui/chromeos/touch_view_controller_delegate.h" |
| 30 #include "chromeos/ime/ime_keyboard.h" | 30 #include "chromeos/ime/ime_keyboard.h" |
| 31 #include "chromeos/ime/input_method_manager.h" | |
| 32 #include "chromeos/network/portal_detector/network_portal_detector.h" | 31 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 33 #include "components/user_manager/user_manager.h" | 32 #include "components/user_manager/user_manager.h" |
| 34 #include "content/public/browser/notification_observer.h" | 33 #include "content/public/browser/notification_observer.h" |
| 35 #include "content/public/browser/notification_registrar.h" | 34 #include "content/public/browser/notification_registrar.h" |
| 36 #include "content/public/browser/web_ui.h" | 35 #include "content/public/browser/web_ui.h" |
| 37 #include "net/base/net_errors.h" | 36 #include "net/base/net_errors.h" |
| 38 #include "ui/events/event_handler.h" | 37 #include "ui/events/event_handler.h" |
| 39 | 38 |
| 40 namespace base { | 39 namespace base { |
| 41 class DictionaryValue; | 40 class DictionaryValue; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 206 |
| 208 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay | 207 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay |
| 209 // and LoginDisplay. | 208 // and LoginDisplay. |
| 210 class SigninScreenHandler | 209 class SigninScreenHandler |
| 211 : public BaseScreenHandler, | 210 : public BaseScreenHandler, |
| 212 public LoginDisplayWebUIHandler, | 211 public LoginDisplayWebUIHandler, |
| 213 public content::NotificationObserver, | 212 public content::NotificationObserver, |
| 214 public ScreenlockBridge::LockHandler, | 213 public ScreenlockBridge::LockHandler, |
| 215 public NetworkStateInformer::NetworkStateInformerObserver, | 214 public NetworkStateInformer::NetworkStateInformerObserver, |
| 216 public input_method::ImeKeyboard::Observer, | 215 public input_method::ImeKeyboard::Observer, |
| 217 public TouchViewControllerDelegate::Observer, | 216 public TouchViewControllerDelegate::Observer { |
| 218 public OobeUI::Observer { | |
| 219 public: | 217 public: |
| 220 SigninScreenHandler( | 218 SigninScreenHandler( |
| 221 const scoped_refptr<NetworkStateInformer>& network_state_informer, | 219 const scoped_refptr<NetworkStateInformer>& network_state_informer, |
| 222 ErrorScreenActor* error_screen_actor, | 220 ErrorScreenActor* error_screen_actor, |
| 223 CoreOobeActor* core_oobe_actor, | 221 CoreOobeActor* core_oobe_actor, |
| 224 GaiaScreenHandler* gaia_screen_handler); | 222 GaiaScreenHandler* gaia_screen_handler); |
| 225 virtual ~SigninScreenHandler(); | 223 virtual ~SigninScreenHandler(); |
| 226 | 224 |
| 227 // Shows the sign in screen. | 225 // Shows the sign in screen. |
| 228 void Show(const LoginScreenContext& context); | 226 void Show(const LoginScreenContext& context); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 241 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) OVERRIDE; | 239 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) OVERRIDE; |
| 242 | 240 |
| 243 // Required Local State preferences. | 241 // Required Local State preferences. |
| 244 static void RegisterPrefs(PrefRegistrySimple* registry); | 242 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 245 | 243 |
| 246 void set_kiosk_enable_flow_aborted_callback_for_test( | 244 void set_kiosk_enable_flow_aborted_callback_for_test( |
| 247 const base::Closure& callback) { | 245 const base::Closure& callback) { |
| 248 kiosk_enable_flow_aborted_callback_for_test_ = callback; | 246 kiosk_enable_flow_aborted_callback_for_test_ = callback; |
| 249 } | 247 } |
| 250 | 248 |
| 251 // OobeUI::Observer implemetation. | |
| 252 virtual void OnCurrentScreenChanged(OobeUI::Screen current_screen, | |
| 253 OobeUI::Screen new_screen) OVERRIDE; | |
| 254 | |
| 255 // Returns least used user login input method. | |
| 256 std::string GetUserLRUInputMethod(const std::string& username) const; | |
| 257 | |
| 258 void SetFocusPODCallbackForTesting(base::Closure callback); | |
| 259 | |
| 260 private: | 249 private: |
| 261 enum UIState { | 250 enum UIState { |
| 262 UI_STATE_UNKNOWN = 0, | 251 UI_STATE_UNKNOWN = 0, |
| 263 UI_STATE_GAIA_SIGNIN, | 252 UI_STATE_GAIA_SIGNIN, |
| 264 UI_STATE_ACCOUNT_PICKER, | 253 UI_STATE_ACCOUNT_PICKER, |
| 265 }; | 254 }; |
| 266 | 255 |
| 267 friend class GaiaScreenHandler; | 256 friend class GaiaScreenHandler; |
| 268 friend class ReportDnsCacheClearedOnUIThread; | 257 friend class ReportDnsCacheClearedOnUIThread; |
| 269 friend class SupervisedUserCreationScreenHandler; | 258 friend class SupervisedUserCreationScreenHandler; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 bool IsSigninScreenHiddenByError() const; | 415 bool IsSigninScreenHiddenByError() const; |
| 427 | 416 |
| 428 // Returns true if guest signin is allowed. | 417 // Returns true if guest signin is allowed. |
| 429 bool IsGuestSigninAllowed() const; | 418 bool IsGuestSigninAllowed() const; |
| 430 | 419 |
| 431 // Returns true if offline login is allowed. | 420 // Returns true if offline login is allowed. |
| 432 bool IsOfflineLoginAllowed() const; | 421 bool IsOfflineLoginAllowed() const; |
| 433 | 422 |
| 434 bool ShouldLoadGaia() const; | 423 bool ShouldLoadGaia() const; |
| 435 | 424 |
| 436 // Update current input method (namely keyboard layout) in the given IME state | 425 // Update current input method (namely keyboard layout) to LRU by this user. |
| 437 // to LRU by this user. | 426 void SetUserInputMethod(const std::string& username); |
| 438 void SetUserInputMethod(const std::string& username, | |
| 439 input_method::InputMethodManager::State* ime_state); | |
| 440 | 427 |
| 441 // Invoked when auto enrollment check progresses to decide whether to | 428 // Invoked when auto enrollment check progresses to decide whether to |
| 442 // continue kiosk enable flow. Kiosk enable flow is resumed when | 429 // continue kiosk enable flow. Kiosk enable flow is resumed when |
| 443 // |state| indicates that enrollment is not applicable. | 430 // |state| indicates that enrollment is not applicable. |
| 444 void ContinueKioskEnableFlow(policy::AutoEnrollmentState state); | 431 void ContinueKioskEnableFlow(policy::AutoEnrollmentState state); |
| 445 | 432 |
| 446 // Shows signin. | 433 // Shows signin. |
| 447 void OnShowAddUser(); | 434 void OnShowAddUser(); |
| 448 | 435 |
| 449 GaiaScreenHandler::FrameState FrameState() const; | 436 GaiaScreenHandler::FrameState FrameState() const; |
| 450 net::Error FrameError() const; | 437 net::Error FrameError() const; |
| 451 | 438 |
| 452 // input_method::ImeKeyboard::Observer implementation: | 439 // input_method::ImeKeyboard::Observer implementation: |
| 453 virtual void OnCapsLockChanged(bool enabled) OVERRIDE; | 440 virtual void OnCapsLockChanged(bool enabled) OVERRIDE; |
| 454 | 441 |
| 455 // Returns OobeUI object of NULL. | |
| 456 OobeUI* GetOobeUI() const; | |
| 457 | |
| 458 // Current UI state of the signin screen. | 442 // Current UI state of the signin screen. |
| 459 UIState ui_state_; | 443 UIState ui_state_; |
| 460 | 444 |
| 461 // A delegate that glues this handler with backend LoginDisplay. | 445 // A delegate that glues this handler with backend LoginDisplay. |
| 462 SigninScreenHandlerDelegate* delegate_; | 446 SigninScreenHandlerDelegate* delegate_; |
| 463 | 447 |
| 464 // A delegate used to get gfx::NativeWindow. | 448 // A delegate used to get gfx::NativeWindow. |
| 465 NativeWindowDelegate* native_window_delegate_; | 449 NativeWindowDelegate* native_window_delegate_; |
| 466 | 450 |
| 467 // Whether screen should be shown right after initialization. | 451 // Whether screen should be shown right after initialization. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 | 494 |
| 511 // Helper that retrieves the authenticated user's e-mail address. | 495 // Helper that retrieves the authenticated user's e-mail address. |
| 512 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; | 496 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; |
| 513 | 497 |
| 514 // Maximized mode controller delegate. | 498 // Maximized mode controller delegate. |
| 515 scoped_ptr<TouchViewControllerDelegate> max_mode_delegate_; | 499 scoped_ptr<TouchViewControllerDelegate> max_mode_delegate_; |
| 516 | 500 |
| 517 // Whether consumer management enrollment is in progress. | 501 // Whether consumer management enrollment is in progress. |
| 518 bool is_enrolling_consumer_management_; | 502 bool is_enrolling_consumer_management_; |
| 519 | 503 |
| 520 // Input Method Engine state used at signin screen. | |
| 521 scoped_refptr<input_method::InputMethodManager::State> ime_state_; | |
| 522 | |
| 523 // This callback captures "focusPod finished" event for tests. | |
| 524 base::Closure test_focus_pod_callback_; | |
| 525 | |
| 526 base::WeakPtrFactory<SigninScreenHandler> weak_factory_; | 504 base::WeakPtrFactory<SigninScreenHandler> weak_factory_; |
| 527 | 505 |
| 528 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); | 506 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); |
| 529 }; | 507 }; |
| 530 | 508 |
| 531 } // namespace chromeos | 509 } // namespace chromeos |
| 532 | 510 |
| 533 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 511 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
| OLD | NEW |