| 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; |
| 22 class IdleDetector; | 23 class IdleDetector; |
| 23 | 24 class InputEventsBlocker; |
| 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 20 matching lines...) Expand all Loading... |
| 55 virtual void GetAdditionalParameters(base::DictionaryValue* dict) override; | 55 virtual void GetAdditionalParameters(base::DictionaryValue* dict) override; |
| 56 virtual void Initialize() override; | 56 virtual void Initialize() override; |
| 57 | 57 |
| 58 // WebUIMessageHandler implementation: | 58 // WebUIMessageHandler implementation: |
| 59 virtual void RegisterMessages() override; | 59 virtual void RegisterMessages() override; |
| 60 | 60 |
| 61 // InputMethodManager::Observer implementation: | 61 // InputMethodManager::Observer implementation: |
| 62 virtual void InputMethodChanged(input_method::InputMethodManager* manager, | 62 virtual void InputMethodChanged(input_method::InputMethodManager* manager, |
| 63 bool show_message) override; | 63 bool show_message) override; |
| 64 | 64 |
| 65 private: |
| 65 // Reloads localized contents. | 66 // Reloads localized contents. |
| 66 void ReloadLocalizedContent(); | 67 void ReloadLocalizedContent(); |
| 67 | 68 |
| 68 // Handles moving off the screen. | 69 // Handles moving off the screen. |
| 69 void HandleOnExit(); | 70 void HandleOnExit(); |
| 70 | 71 |
| 71 // Async callback after ReloadResourceBundle(locale) completed. | 72 // Async callback after ReloadResourceBundle(locale) completed. |
| 72 static void OnLanguageChangedCallback( | 73 void OnLanguageChangedCallback( |
| 73 scoped_ptr<NetworkScreenHandlerOnLanguageChangedCallbackData> context, | 74 const InputEventsBlocker* input_events_blocker, |
| 74 const std::string& requested_locale, | 75 const locale_util::LanguageSwitchResult& result); |
| 75 const std::string& loaded_locale, | |
| 76 const bool success); | |
| 77 | 76 |
| 78 // Callback when the system timezone settings is changed. | 77 // Callback when the system timezone settings is changed. |
| 79 void OnSystemTimezoneChanged(); | 78 void OnSystemTimezoneChanged(); |
| 80 | 79 |
| 81 // Returns available timezones. Caller gets the ownership. | 80 // Returns available timezones. Caller gets the ownership. |
| 82 static base::ListValue* GetTimezoneList(); | 81 static base::ListValue* GetTimezoneList(); |
| 83 | 82 |
| 83 // Starts resolving language list on BlockingPool. |
| 84 void ScheduleResolveLanguageList( |
| 85 scoped_ptr<locale_util::LanguageSwitchResult> language_switch_result); |
| 86 |
| 87 // Callback for chromeos::ResolveUILanguageList() (from l10n_util). |
| 88 void OnLanguageListResolved(scoped_ptr<base::ListValue> new_language_list, |
| 89 std::string new_language_list_locale, |
| 90 std::string new_selected_language); |
| 91 |
| 84 NetworkScreenActor::Delegate* screen_; | 92 NetworkScreenActor::Delegate* screen_; |
| 85 CoreOobeActor* core_oobe_actor_; | 93 CoreOobeActor* core_oobe_actor_; |
| 86 | 94 |
| 87 bool is_continue_enabled_; | 95 bool is_continue_enabled_; |
| 88 | 96 |
| 89 // Keeps whether screen should be shown right after initialization. | 97 // Keeps whether screen should be shown right after initialization. |
| 90 bool show_on_init_; | 98 bool show_on_init_; |
| 91 | 99 |
| 92 // Position of the network control. | 100 // Position of the network control. |
| 93 gfx::Point network_control_pos_; | 101 gfx::Point network_control_pos_; |
| 94 | 102 |
| 95 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_; | 103 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_; |
| 96 | 104 |
| 97 // The exact language code selected by user in the menu. | 105 // The exact language code selected by user in the menu. |
| 98 std::string selected_language_code_; | 106 std::string selected_language_code_; |
| 99 | 107 |
| 100 std::string locale_; | 108 std::string locale_; |
| 101 std::string input_method_; | 109 std::string input_method_; |
| 102 std::string timezone_; | 110 std::string timezone_; |
| 103 | 111 |
| 112 // Creation of language list happens on Blocking Pool, so we cache resolved |
| 113 // data. |
| 114 std::string language_list_locale_; |
| 115 scoped_ptr<base::ListValue> language_list_; |
| 116 |
| 104 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_; | 117 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_; |
| 105 | 118 |
| 106 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler); | 119 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler); |
| 107 }; | 120 }; |
| 108 | 121 |
| 109 } // namespace chromeos | 122 } // namespace chromeos |
| 110 | 123 |
| 111 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ | 124 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ |
| OLD | NEW |