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