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