| 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 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: |
| 58 // Reloads localized contents. | 59 // Reloads localized contents. |
| 59 void ReloadLocalizedContent(); | 60 void ReloadLocalizedContent(); |
| 60 | 61 |
| 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 static void OnLanguageChangedCallback( | 69 void OnLanguageChangedCallback( |
| 70 scoped_ptr<NetworkScreenHandlerOnLanguageChangedCallbackData> context, | 70 const InputEventsBlocker* input_events_blocker, |
| 71 const std::string& requested_locale, | 71 const locale_util::LanguageSwitchResult& result); |
| 72 const std::string& loaded_locale, | |
| 73 const bool success); | |
| 74 | 72 |
| 75 // Handles change of the input method. | 73 // Handles change of the input method. |
| 76 void HandleOnInputMethodChanged(const std::string& id); | 74 void HandleOnInputMethodChanged(const std::string& id); |
| 77 | 75 |
| 78 // Handles change of the time zone | 76 // Handles change of the time zone |
| 79 void HandleOnTimezoneChanged(const std::string& timezone); | 77 void HandleOnTimezoneChanged(const std::string& timezone); |
| 80 | 78 |
| 81 // Callback when the system timezone settings is changed. | 79 // Callback when the system timezone settings is changed. |
| 82 void OnSystemTimezoneChanged(); | 80 void OnSystemTimezoneChanged(); |
| 83 | 81 |
| 84 // Returns available timezones. Caller gets the ownership. | 82 // Returns available timezones. Caller gets the ownership. |
| 85 static base::ListValue* GetTimezoneList(); | 83 static base::ListValue* GetTimezoneList(); |
| 86 | 84 |
| 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 |
| 87 NetworkScreenActor::Delegate* screen_; | 94 NetworkScreenActor::Delegate* screen_; |
| 88 CoreOobeActor* core_oobe_actor_; | 95 CoreOobeActor* core_oobe_actor_; |
| 89 | 96 |
| 90 bool is_continue_enabled_; | 97 bool is_continue_enabled_; |
| 91 | 98 |
| 92 // Keeps whether screen should be shown right after initialization. | 99 // Keeps whether screen should be shown right after initialization. |
| 93 bool show_on_init_; | 100 bool show_on_init_; |
| 94 | 101 |
| 95 // Position of the network control. | 102 // Position of the network control. |
| 96 gfx::Point network_control_pos_; | 103 gfx::Point network_control_pos_; |
| 97 | 104 |
| 98 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_; | 105 scoped_ptr<CrosSettings::ObserverSubscription> timezone_subscription_; |
| 99 | 106 |
| 100 // The exact language code selected by user in the menu. | 107 // The exact language code selected by user in the menu. |
| 101 std::string selected_language_code_; | 108 std::string selected_language_code_; |
| 102 | 109 |
| 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 |
| 103 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_; | 115 base::WeakPtrFactory<NetworkScreenHandler> weak_ptr_factory_; |
| 104 | 116 |
| 105 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler); | 117 DISALLOW_COPY_AND_ASSIGN(NetworkScreenHandler); |
| 106 }; | 118 }; |
| 107 | 119 |
| 108 } // namespace chromeos | 120 } // namespace chromeos |
| 109 | 121 |
| 110 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ | 122 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_SCREEN_HANDLER_H_ |
| OLD | NEW |