| 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_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H
_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H
_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H
_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H
_ |
| 7 | 7 |
| 8 #include <memory> | |
| 9 #include <string> | 8 #include <string> |
| 10 | 9 |
| 11 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 11 #include "base/macros.h" |
| 13 #include "chrome/browser/ui/webui/options/language_options_handler.h" | 12 #include "chrome/browser/ui/webui/options/language_options_handler.h" |
| 14 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" | 13 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" |
| 15 #include "ui/base/ime/chromeos/input_method_descriptor.h" | 14 #include "ui/base/ime/chromeos/input_method_descriptor.h" |
| 16 | 15 |
| 17 namespace base { | |
| 18 class ListValue; | |
| 19 } | |
| 20 | |
| 21 namespace chromeos { | 16 namespace chromeos { |
| 22 namespace options { | 17 namespace options { |
| 23 | 18 |
| 24 // Language options page UI handler for Chrome OS. For non-Chrome OS, | 19 // Language options page UI handler for Chrome OS. For non-Chrome OS, |
| 25 // see LanguageOptionsHnadler. | 20 // see LanguageOptionsHnadler. |
| 26 class CrosLanguageOptionsHandler | 21 class CrosLanguageOptionsHandler |
| 27 : public ::options::LanguageOptionsHandlerCommon { | 22 : public ::options::LanguageOptionsHandlerCommon { |
| 28 public: | 23 public: |
| 29 CrosLanguageOptionsHandler(); | 24 CrosLanguageOptionsHandler(); |
| 30 ~CrosLanguageOptionsHandler() override; | 25 ~CrosLanguageOptionsHandler() override; |
| 31 | 26 |
| 32 // OptionsPageUIHandler implementation. | 27 // OptionsPageUIHandler implementation. |
| 33 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 28 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
| 34 | 29 |
| 35 // DOMMessageHandler implementation. | 30 // DOMMessageHandler implementation. |
| 36 void RegisterMessages() override; | 31 void RegisterMessages() override; |
| 37 | 32 |
| 38 // The following static methods are public for ease of testing. | 33 // The following static methods are public for ease of testing. |
| 39 | 34 |
| 40 // Gets the list of supported input methods. | 35 // Gets the list of supported input methods. |
| 41 // The return value will look like: | 36 // The return value will look like: |
| 42 // [{'id': 'pinyin', 'displayName': 'Pinyin', | 37 // [{'id': 'pinyin', 'displayName': 'Pinyin', |
| 43 // 'languageCodeSet': {'zh-CW': true}}, ...] | 38 // 'languageCodeSet': {'zh-CW': true}}, ...] |
| 44 // | 39 // |
| 45 // Note that true in languageCodeSet does not mean anything. We just use | 40 // Note that true in languageCodeSet does not mean anything. We just use |
| 46 // the dictionary as a set. | 41 // the dictionary as a set. |
| 47 static std::unique_ptr<base::ListValue> GetInputMethodList(); | 42 static base::ListValue* GetInputMethodList(); |
| 48 | 43 |
| 49 // Converts input method descriptors to the list of input methods. | 44 // Converts input method descriptors to the list of input methods. |
| 50 // The return value will look like: | 45 // The return value will look like: |
| 51 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest', | 46 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest', |
| 52 // 'displayName': 'Sample IME'}, ...] | 47 // 'displayName': 'Sample IME'}, ...] |
| 53 static std::unique_ptr<base::ListValue> | 48 static base::ListValue* ConvertInputMethodDescriptorsToIMEList( |
| 54 ConvertInputMethodDescriptorsToIMEList( | |
| 55 const input_method::InputMethodDescriptors& descriptors); | 49 const input_method::InputMethodDescriptors& descriptors); |
| 56 | 50 |
| 57 private: | 51 private: |
| 58 // LanguageOptionsHandlerCommon implementation. | 52 // LanguageOptionsHandlerCommon implementation. |
| 59 void SetApplicationLocale(const std::string& language_code) override; | 53 void SetApplicationLocale(const std::string& language_code) override; |
| 60 | 54 |
| 61 // Called when the sign-out button is clicked. | 55 // Called when the sign-out button is clicked. |
| 62 void RestartCallback(const base::ListValue* args); | 56 void RestartCallback(const base::ListValue* args); |
| 63 | 57 |
| 64 // Called when the input method is disabled. | 58 // Called when the input method is disabled. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 77 // |list| of extension IMEs. | 71 // |list| of extension IMEs. |
| 78 void AddImeProvider(base::ListValue* list); | 72 void AddImeProvider(base::ListValue* list); |
| 79 | 73 |
| 80 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler); | 74 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler); |
| 81 }; | 75 }; |
| 82 | 76 |
| 83 } // namespace options | 77 } // namespace options |
| 84 } // namespace chromeos | 78 } // namespace chromeos |
| 85 | 79 |
| 86 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLE
R_H_ | 80 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLE
R_H_ |
| OLD | NEW |