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/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/chromeos/base/locale_util.h" | |
13 #include "chrome/browser/chromeos/login/screens/network_screen_actor.h" | 12 #include "chrome/browser/chromeos/login/screens/network_screen_actor.h" |
14 #include "chrome/browser/chromeos/settings/cros_settings.h" | 13 #include "chrome/browser/chromeos/settings/cros_settings.h" |
15 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 14 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
16 #include "chromeos/ime/component_extension_ime_manager.h" | 15 #include "chromeos/ime/component_extension_ime_manager.h" |
17 #include "chromeos/ime/input_method_manager.h" | 16 #include "chromeos/ime/input_method_manager.h" |
18 #include "ui/gfx/point.h" | 17 #include "ui/gfx/point.h" |
19 | 18 |
20 namespace chromeos { | 19 namespace chromeos { |
21 | 20 |
22 class CoreOobeActor; | 21 class CoreOobeActor; |
23 class IdleDetector; | 22 class IdleDetector; |
24 class InputEventsBlocker; | 23 |
| 24 struct NetworkScreenHandlerOnLanguageChangedCallbackData; |
25 | 25 |
26 // WebUI implementation of NetworkScreenActor. It is used to interact with | 26 // WebUI implementation of NetworkScreenActor. It is used to interact with |
27 // the welcome screen (part of the page) of the OOBE. | 27 // the welcome screen (part of the page) of the OOBE. |
28 class NetworkScreenHandler : public NetworkScreenActor, | 28 class NetworkScreenHandler : public NetworkScreenActor, |
29 public BaseScreenHandler, | 29 public BaseScreenHandler, |
30 public input_method::InputMethodManager::Observer { | 30 public input_method::InputMethodManager::Observer { |
31 public: | 31 public: |
32 explicit NetworkScreenHandler(CoreOobeActor* core_oobe_actor); | 32 explicit NetworkScreenHandler(CoreOobeActor* core_oobe_actor); |
33 virtual ~NetworkScreenHandler(); | 33 virtual ~NetworkScreenHandler(); |
34 | 34 |
(...skipping 13 matching lines...) Expand all Loading... |
48 virtual void GetAdditionalParameters(base::DictionaryValue* dict) override; | 48 virtual void GetAdditionalParameters(base::DictionaryValue* dict) override; |
49 virtual void Initialize() override; | 49 virtual void Initialize() override; |
50 | 50 |
51 // WebUIMessageHandler implementation: | 51 // WebUIMessageHandler implementation: |
52 virtual void RegisterMessages() override; | 52 virtual void RegisterMessages() override; |
53 | 53 |
54 // InputMethodManager::Observer implementation: | 54 // InputMethodManager::Observer implementation: |
55 virtual void InputMethodChanged(input_method::InputMethodManager* manager, | 55 virtual void InputMethodChanged(input_method::InputMethodManager* manager, |
56 bool show_message) override; | 56 bool show_message) override; |
57 | 57 |
58 private: | |
59 // Reloads localized contents. | 58 // Reloads localized contents. |
60 void ReloadLocalizedContent(); | 59 void ReloadLocalizedContent(); |
61 | 60 |
| 61 private: |
62 // Handles moving off the screen. | 62 // Handles moving off the screen. |
63 void HandleOnExit(); | 63 void HandleOnExit(); |
64 | 64 |
65 // Handles change of the language. | 65 // Handles change of the language. |
66 void HandleOnLanguageChanged(const std::string& locale); | 66 void HandleOnLanguageChanged(const std::string& locale); |
67 | 67 |
68 // Async callback after ReloadResourceBundle(locale) completed. | 68 // Async callback after ReloadResourceBundle(locale) completed. |
69 void OnLanguageChangedCallback( | 69 static void OnLanguageChangedCallback( |
70 const InputEventsBlocker* input_events_blocker, | 70 scoped_ptr<NetworkScreenHandlerOnLanguageChangedCallbackData> context, |
71 const locale_util::LanguageSwitchResult& result); | 71 const std::string& requested_locale, |
| 72 const std::string& loaded_locale, |
| 73 const bool success); |
72 | 74 |
73 // Handles change of the input method. | 75 // Handles change of the input method. |
74 void HandleOnInputMethodChanged(const std::string& id); | 76 void HandleOnInputMethodChanged(const std::string& id); |
75 | 77 |
76 // Handles change of the time zone | 78 // Handles change of the time zone |
77 void HandleOnTimezoneChanged(const std::string& timezone); | 79 void HandleOnTimezoneChanged(const std::string& timezone); |
78 | 80 |
79 // Callback when the system timezone settings is changed. | 81 // Callback when the system timezone settings is changed. |
80 void OnSystemTimezoneChanged(); | 82 void OnSystemTimezoneChanged(); |
81 | 83 |
82 // Returns available timezones. Caller gets the ownership. | 84 // Returns available timezones. Caller gets the ownership. |
83 static base::ListValue* GetTimezoneList(); | 85 static base::ListValue* GetTimezoneList(); |
84 | 86 |
85 // Starts resolving language list on BlockingPool. | |
86 void ScheduleResolveLanguageList( | |
87 scoped_ptr<locale_util::LanguageSwitchResult> language_switch_result); | |
88 | |
89 // Callback for chromeos::ResolveUILanguageList() (from l10n_util). | |
90 void OnLanguageListResolved(scoped_ptr<base::ListValue> new_language_list, | |
91 std::string new_language_list_locale, | |
92 std::string new_selected_language); | |
93 | |
94 NetworkScreenActor::Delegate* screen_; | 87 NetworkScreenActor::Delegate* screen_; |
95 CoreOobeActor* core_oobe_actor_; | 88 CoreOobeActor* core_oobe_actor_; |
96 | 89 |
97 bool is_continue_enabled_; | 90 bool is_continue_enabled_; |
98 | 91 |
99 // Keeps whether screen should be shown right after initialization. | 92 // Keeps whether screen should be shown right after initialization. |
100 bool show_on_init_; | 93 bool show_on_init_; |
101 | 94 |
102 // Position of the network control. | 95 // Position of the network control. |
103 gfx::Point network_control_pos_; | 96 gfx::Point network_control_pos_; |
104 | 97 |
105 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_; | 98 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_; |
106 | 99 |
107 // The exact language code selected by user in the menu. | 100 // The exact language code selected by user in the menu. |
108 std::string selected_language_code_; | 101 std::string selected_language_code_; |
109 | 102 |
110 // Creation of language list happens on Blocking Pool, so we cache resolved | |
111 // data. | |
112 std::string language_list_locale_; | |
113 scoped_ptr<base::ListValue> language_list_; | |
114 | |
115 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_; | 103 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_; |
116 | 104 |
117 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler); | 105 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler); |
118 }; | 106 }; |
119 | 107 |
120 } // namespace chromeos | 108 } // namespace chromeos |
121 | 109 |
122 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ | 110 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ |
OLD | NEW |