| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NETWORK_SCREEN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/time/time.h" |
| 11 #include "chrome/browser/chromeos/login/screens/network_screen_actor.h" | 12 #include "chrome/browser/chromeos/login/screens/network_screen_actor.h" |
| 12 #include "chrome/browser/chromeos/settings/cros_settings.h" | 13 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 13 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 14 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 14 #include "ui/gfx/point.h" | 15 #include "ui/gfx/point.h" |
| 15 | 16 |
| 17 class PrefRegistrySimple; |
| 18 |
| 16 namespace chromeos { | 19 namespace chromeos { |
| 17 | 20 |
| 18 class CoreOobeActor; | 21 class CoreOobeActor; |
| 22 class IdleDetector; |
| 19 | 23 |
| 20 struct NetworkScreenHandlerOnLanguageChangedCallbackData; | 24 struct NetworkScreenHandlerOnLanguageChangedCallbackData; |
| 21 | 25 |
| 22 // WebUI implementation of NetworkScreenActor. It is used to interact with | 26 // WebUI implementation of NetworkScreenActor. It is used to interact with |
| 23 // the welcome screen (part of the page) of the OOBE. | 27 // the welcome screen (part of the page) of the OOBE. |
| 24 class NetworkScreenHandler : public NetworkScreenActor, | 28 class NetworkScreenHandler : public NetworkScreenActor, |
| 25 public BaseScreenHandler { | 29 public BaseScreenHandler { |
| 26 public: | 30 public: |
| 27 explicit NetworkScreenHandler(CoreOobeActor* core_oobe_actor); | 31 explicit NetworkScreenHandler(CoreOobeActor* core_oobe_actor); |
| 28 virtual ~NetworkScreenHandler(); | 32 virtual ~NetworkScreenHandler(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 virtual void EnableContinue(bool enabled) OVERRIDE; | 43 virtual void EnableContinue(bool enabled) OVERRIDE; |
| 40 | 44 |
| 41 // BaseScreenHandler implementation: | 45 // BaseScreenHandler implementation: |
| 42 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE; | 46 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE; |
| 43 virtual void GetAdditionalParameters(base::DictionaryValue* dict) OVERRIDE; | 47 virtual void GetAdditionalParameters(base::DictionaryValue* dict) OVERRIDE; |
| 44 virtual void Initialize() OVERRIDE; | 48 virtual void Initialize() OVERRIDE; |
| 45 | 49 |
| 46 // WebUIMessageHandler implementation: | 50 // WebUIMessageHandler implementation: |
| 47 virtual void RegisterMessages() OVERRIDE; | 51 virtual void RegisterMessages() OVERRIDE; |
| 48 | 52 |
| 53 // Registers the preference for derelict state. |
| 54 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 55 |
| 49 private: | 56 private: |
| 50 // Handles moving off the screen. | 57 // Handles moving off the screen. |
| 51 void HandleOnExit(); | 58 void HandleOnExit(); |
| 52 | 59 |
| 53 // Handles change of the language. | 60 // Handles change of the language. |
| 54 void HandleOnLanguageChanged(const std::string& locale); | 61 void HandleOnLanguageChanged(const std::string& locale); |
| 55 | 62 |
| 56 // Async callback after ReloadResourceBundle(locale) completed. | 63 // Async callback after ReloadResourceBundle(locale) completed. |
| 57 static void OnLanguageChangedCallback( | 64 static void OnLanguageChangedCallback( |
| 58 scoped_ptr<NetworkScreenHandlerOnLanguageChangedCallbackData> context, | 65 scoped_ptr<NetworkScreenHandlerOnLanguageChangedCallbackData> context, |
| 59 const std::string& requested_locale, | 66 const std::string& requested_locale, |
| 60 const std::string& loaded_locale, | 67 const std::string& loaded_locale, |
| 61 const bool success); | 68 const bool success); |
| 62 | 69 |
| 63 // Handles change of the input method. | 70 // Handles change of the input method. |
| 64 void HandleOnInputMethodChanged(const std::string& id); | 71 void HandleOnInputMethodChanged(const std::string& id); |
| 65 | 72 |
| 66 // Handles change of the time zone | 73 // Handles change of the time zone |
| 67 void HandleOnTimezoneChanged(const std::string& timezone); | 74 void HandleOnTimezoneChanged(const std::string& timezone); |
| 68 | 75 |
| 69 // Callback when the system timezone settings is changed. | 76 // Callback when the system timezone settings is changed. |
| 70 void OnSystemTimezoneChanged(); | 77 void OnSystemTimezoneChanged(); |
| 71 | 78 |
| 79 // Idle detection related methods. |
| 80 void StartIdleDetection(); |
| 81 void OnIdle(); |
| 82 void SetupTimeouts(); |
| 83 |
| 72 // Returns available languages. Caller gets the ownership. Note, it does | 84 // Returns available languages. Caller gets the ownership. Note, it does |
| 73 // depend on the current locale. | 85 // depend on the current locale. |
| 74 static base::ListValue* GetLanguageList(); | 86 static base::ListValue* GetLanguageList(); |
| 75 | 87 |
| 76 // Returns available input methods. Caller gets the ownership. Note, it does | 88 // Returns available input methods. Caller gets the ownership. Note, it does |
| 77 // depend on the current locale. | 89 // depend on the current locale. |
| 78 static base::ListValue* GetInputMethods(); | 90 static base::ListValue* GetInputMethods(); |
| 79 | 91 |
| 80 // Returns available timezones. Caller gets the ownership. | 92 // Returns available timezones. Caller gets the ownership. |
| 81 static base::ListValue* GetTimezoneList(); | 93 static base::ListValue* GetTimezoneList(); |
| 82 | 94 |
| 83 NetworkScreenActor::Delegate* screen_; | 95 NetworkScreenActor::Delegate* screen_; |
| 84 CoreOobeActor* core_oobe_actor_; | 96 CoreOobeActor* core_oobe_actor_; |
| 85 | 97 |
| 86 bool is_continue_enabled_; | 98 bool is_continue_enabled_; |
| 87 | 99 |
| 100 // Flag set if we believe this is an abandoned machine. |
| 101 bool is_derelict_; |
| 102 |
| 88 // Keeps whether screen should be shown right after initialization. | 103 // Keeps whether screen should be shown right after initialization. |
| 89 bool show_on_init_; | 104 bool show_on_init_; |
| 90 | 105 |
| 91 // Position of the network control. | 106 // Position of the network control. |
| 92 gfx::Point network_control_pos_; | 107 gfx::Point network_control_pos_; |
| 93 | 108 |
| 94 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_; | 109 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_; |
| 95 | 110 |
| 111 scoped_ptr<IdleDetector> detector_; |
| 112 |
| 113 // Timeout to detect if the machine is in a derelict state. |
| 114 base::TimeDelta derelict_detection_timeout_; |
| 115 // Timeout before showing our demo up if the machine is in a derelict state. |
| 116 base::TimeDelta derelict_idle_timeout_; |
| 117 |
| 96 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_; | 118 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_; |
| 97 | 119 |
| 98 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler); | 120 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler); |
| 99 }; | 121 }; |
| 100 | 122 |
| 101 } // namespace chromeos | 123 } // namespace chromeos |
| 102 | 124 |
| 103 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ | 125 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ |
| OLD | NEW |