Chromium Code Reviews| 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" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // Reloads localized contents. | 58 // Reloads localized contents. |
| 59 void ReloadLocalizedContent(); | 59 void ReloadLocalizedContent(); |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 struct LanguageSwitchResult { | |
| 63 std::string requested_locale; | |
| 64 std::string loaded_locale; | |
| 65 bool success; | |
| 66 }; | |
| 67 | |
| 62 // Handles moving off the screen. | 68 // Handles moving off the screen. |
| 63 void HandleOnExit(); | 69 void HandleOnExit(); |
| 64 | 70 |
| 65 // Handles change of the language. | 71 // Handles change of the language. |
| 66 void HandleOnLanguageChanged(const std::string& locale); | 72 void HandleOnLanguageChanged(const std::string& locale); |
| 67 | 73 |
| 68 // Async callback after ReloadResourceBundle(locale) completed. | 74 // Async callback after ReloadResourceBundle(locale) completed. |
| 69 static void OnLanguageChangedCallback( | 75 static void OnLanguageChangedCallback( |
| 70 scoped_ptr<NetworkScreenHandlerOnLanguageChangedCallbackData> context, | 76 scoped_ptr<NetworkScreenHandlerOnLanguageChangedCallbackData> context, |
| 71 const std::string& requested_locale, | 77 const std::string& requested_locale, |
| 72 const std::string& loaded_locale, | 78 const std::string& loaded_locale, |
| 73 const bool success); | 79 const bool success); |
| 74 | 80 |
| 75 // Handles change of the input method. | 81 // Handles change of the input method. |
| 76 void HandleOnInputMethodChanged(const std::string& id); | 82 void HandleOnInputMethodChanged(const std::string& id); |
| 77 | 83 |
| 78 // Handles change of the time zone | 84 // Handles change of the time zone |
| 79 void HandleOnTimezoneChanged(const std::string& timezone); | 85 void HandleOnTimezoneChanged(const std::string& timezone); |
| 80 | 86 |
| 81 // Callback when the system timezone settings is changed. | 87 // Callback when the system timezone settings is changed. |
| 82 void OnSystemTimezoneChanged(); | 88 void OnSystemTimezoneChanged(); |
| 83 | 89 |
| 84 // Returns available timezones. Caller gets the ownership. | 90 // Returns available timezones. Caller gets the ownership. |
| 85 static base::ListValue* GetTimezoneList(); | 91 static base::ListValue* GetTimezoneList(); |
| 86 | 92 |
| 93 // Starts resolving language list on BlockingPool. | |
| 94 void ScheduleResolveLanguageList(); | |
| 95 | |
| 96 // Callback for ScheduleResolveLanguageList(). | |
| 97 void OnLanguageListResolved( | |
| 98 scoped_ptr<scoped_ptr<base::ListValue>> new_language_list, | |
| 99 scoped_ptr<std::string> new_language_list_locale, | |
| 100 scoped_ptr<std::string> new_selected_language); | |
| 101 | |
| 87 NetworkScreenActor::Delegate* screen_; | 102 NetworkScreenActor::Delegate* screen_; |
| 88 CoreOobeActor* core_oobe_actor_; | 103 CoreOobeActor* core_oobe_actor_; |
| 89 | 104 |
| 90 bool is_continue_enabled_; | 105 bool is_continue_enabled_; |
| 91 | 106 |
| 92 // Keeps whether screen should be shown right after initialization. | 107 // Keeps whether screen should be shown right after initialization. |
| 93 bool show_on_init_; | 108 bool show_on_init_; |
| 94 | 109 |
| 95 // Position of the network control. | 110 // Position of the network control. |
| 96 gfx::Point network_control_pos_; | 111 gfx::Point network_control_pos_; |
| 97 | 112 |
| 98 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_; | 113 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_; |
| 99 | 114 |
| 100 // The exact language code selected by user in the menu. | 115 // The exact language code selected by user in the menu. |
| 101 std::string selected_language_code_; | 116 std::string selected_language_code_; |
| 102 | 117 |
| 118 // Creation of language list happens on Blocking Pool, so we cache resolved | |
| 119 // data. | |
| 120 std::string language_list_locale_; | |
| 121 scoped_ptr<base::ListValue> language_list_; | |
| 122 | |
| 123 // "Selected language" should be calculated on Blocking Pool, so we need to | |
| 124 // remember results of language switching. | |
| 125 LanguageSwitchResult language_switch_result_; | |
|
dzhioev (left Google)
2014/10/01 15:08:08
No need to save this struct.
Alexander Alekseev
2014/10/02 13:12:07
Done.
| |
| 126 | |
| 103 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_; | 127 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_; |
| 104 | 128 |
| 105 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler); | 129 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler); |
| 106 }; | 130 }; |
| 107 | 131 |
| 108 } // namespace chromeos | 132 } // namespace chromeos |
| 109 | 133 |
| 110 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ | 134 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ |
| OLD | NEW |