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