OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 9 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
10 #include "chrome/browser/ui/webui/options/language_options_handler.h" | 10 #include "chrome/browser/ui/webui/options/language_options_handler.h" |
11 | 11 |
12 namespace chromeos { | 12 namespace chromeos { |
13 | 13 |
14 // Language options page UI handler for Chrome OS. For non-Chrome OS, | 14 // Language options page UI handler for Chrome OS. For non-Chrome OS, |
15 // see LanguageOptionsHnadler. | 15 // see LanguageOptionsHnadler. |
16 class CrosLanguageOptionsHandler : public LanguageOptionsHandlerCommon { | 16 class CrosLanguageOptionsHandler : public LanguageOptionsHandlerCommon { |
17 public: | 17 public: |
18 CrosLanguageOptionsHandler(); | 18 CrosLanguageOptionsHandler(); |
19 virtual ~CrosLanguageOptionsHandler(); | 19 virtual ~CrosLanguageOptionsHandler(); |
20 | 20 |
21 // OptionsPageUIHandler implementation. | 21 // OptionsPageUIHandler implementation. |
22 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 22 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); |
23 | 23 |
24 // DOMMessageHandler implementation. | 24 // DOMMessageHandler implementation. |
25 virtual void RegisterMessages(); | 25 virtual void RegisterMessages(); |
26 | 26 |
27 // The following static methods are public for ease of testing. | 27 // The following static methods are public for ease of testing. |
28 | 28 |
29 // Gets the list of input methods from the given input descriptors. | 29 // Gets the list of input methods from the given input descriptors. |
30 // The return value will look like: | 30 // The return value will look like: |
31 // [{'id': 'pinyin', 'displayName': 'Pinyin', | 31 // [{'id': 'pinyin', 'displayName': 'Pinyin', |
32 // 'languageCodeSet': {'zh-CW': true}}, ...] | 32 // 'languageCodeSet': {'zh-CW': true}}, ...] |
33 // | 33 // |
34 // Note that true in languageCodeSet does not mean anything. We just use | 34 // Note that true in languageCodeSet does not mean anything. We just use |
35 // the dictionary as a set. | 35 // the dictionary as a set. |
36 static ListValue* GetInputMethodList( | 36 static base::ListValue* GetInputMethodList( |
37 const input_method::InputMethodDescriptors& descriptors); | 37 const input_method::InputMethodDescriptors& descriptors); |
38 | 38 |
39 // Gets the list of languages from the given input descriptors. | 39 // Gets the list of languages from the given input descriptors. |
40 // The return value will look like: | 40 // The return value will look like: |
41 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, | 41 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, |
42 // ...] | 42 // ...] |
43 static ListValue* GetLanguageList( | 43 static base::ListValue* GetLanguageList( |
44 const input_method::InputMethodDescriptors& descriptors); | 44 const input_method::InputMethodDescriptors& descriptors); |
45 | 45 |
46 private: | 46 private: |
47 // LanguageOptionsHandlerCommon implementation. | 47 // LanguageOptionsHandlerCommon implementation. |
48 virtual string16 GetProductName(); | 48 virtual string16 GetProductName(); |
49 virtual void SetApplicationLocale(const std::string& language_code); | 49 virtual void SetApplicationLocale(const std::string& language_code); |
50 | 50 |
51 // Called when the sign-out button is clicked. | 51 // Called when the sign-out button is clicked. |
52 void RestartCallback(const ListValue* args); | 52 void RestartCallback(const base::ListValue* args); |
53 | 53 |
54 // Called when the input method is disabled. | 54 // Called when the input method is disabled. |
55 // |args| will contain the input method ID as string (ex. "mozc"). | 55 // |args| will contain the input method ID as string (ex. "mozc"). |
56 void InputMethodDisableCallback(const ListValue* args); | 56 void InputMethodDisableCallback(const base::ListValue* args); |
57 | 57 |
58 // Called when the input method is enabled. | 58 // Called when the input method is enabled. |
59 // |args| will contain the input method ID as string (ex. "mozc"). | 59 // |args| will contain the input method ID as string (ex. "mozc"). |
60 void InputMethodEnableCallback(const ListValue* args); | 60 void InputMethodEnableCallback(const base::ListValue* args); |
61 | 61 |
62 // Called when the input method options page is opened. | 62 // Called when the input method options page is opened. |
63 // |args| will contain the input method ID as string (ex. "mozc"). | 63 // |args| will contain the input method ID as string (ex. "mozc"). |
64 void InputMethodOptionsOpenCallback(const ListValue* args); | 64 void InputMethodOptionsOpenCallback(const base::ListValue* args); |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler); | 66 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace chromeos | 69 } // namespace chromeos |
70 | 70 |
71 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLE
R_H_ | 71 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLE
R_H_ |
OLD | NEW |