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_DOM_UI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ |
6 #define CHROME_BROWSER_DOM_UI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // TODO(csilv): This is for the move CL. Changes to make this cross-platform | 9 #include "chrome/browser/dom_ui/options/options_ui.h" |
10 // will come in the followup CL. | 10 |
11 #if defined(OS_CHROMEOS) | 11 #if defined(OS_CHROMEOS) |
12 | |
13 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 12 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
14 #include "chrome/browser/dom_ui/options/options_ui.h" | 13 #endif // defined(OS_CHROMEOS) |
15 | 14 |
16 class DictionaryValue; | 15 class DictionaryValue; |
17 class ListValue; | 16 class ListValue; |
18 | 17 |
19 namespace chromeos { | 18 // Language options page UI handler. |
20 | |
21 // ChromeOS language options page UI handler. | |
22 class LanguageOptionsHandler : public OptionsPageUIHandler { | 19 class LanguageOptionsHandler : public OptionsPageUIHandler { |
23 public: | 20 public: |
24 LanguageOptionsHandler(); | 21 LanguageOptionsHandler(); |
25 virtual ~LanguageOptionsHandler(); | 22 virtual ~LanguageOptionsHandler(); |
26 | 23 |
27 // OptionsUIHandler implementation. | 24 // OptionsUIHandler implementation. |
28 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 25 virtual void GetLocalizedValues(DictionaryValue* localized_strings); |
29 | 26 |
30 // DOMMessageHandler implementation. | 27 // DOMMessageHandler implementation. |
31 virtual void RegisterMessages(); | 28 virtual void RegisterMessages(); |
32 | 29 |
33 // The following static methods are public for ease of testing. | 30 // The following static methods are public for ease of testing. |
34 | 31 |
35 // Gets the list of input methods from the given input descriptors. | 32 // Gets the list of input methods from the given input descriptors. |
36 // The return value will look like: | 33 // The return value will look like: |
37 // [{'id': 'pinyin', 'displayName': 'Pinyin', | 34 // [{'id': 'pinyin', 'displayName': 'Pinyin', |
38 // 'languageCodeSet': {'zh-CW': true}}, ...] | 35 // 'languageCodeSet': {'zh-CW': true}}, ...] |
39 // | 36 // |
40 // Note that true in languageCodeSet does not mean anything. We just use | 37 // Note that true in languageCodeSet does not mean anything. We just use |
41 // the dictionary as a set. | 38 // the dictionary as a set. |
| 39 #if defined(OS_CHROMEOS) |
42 static ListValue* GetInputMethodList( | 40 static ListValue* GetInputMethodList( |
43 const InputMethodDescriptors& descriptors); | 41 const chromeos::InputMethodDescriptors& descriptors); |
| 42 #endif // defined(OS_CHROMEOS) |
44 | 43 |
45 // Gets the list of languages from the given input descriptors. | 44 // Gets the list of languages from the given input descriptors. |
46 // The return value will look like: | 45 // The return value will look like: |
47 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, | 46 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, |
48 // ...] | 47 // ...] |
49 static ListValue* GetLanguageList(const InputMethodDescriptors& descriptors); | 48 #if defined(OS_CHROMEOS) |
| 49 static ListValue* GetLanguageList( |
| 50 const chromeos::InputMethodDescriptors& descriptors); |
| 51 #else |
| 52 static ListValue* GetLanguageList(); |
| 53 #endif // defined(OS_CHROMEOS) |
50 | 54 |
51 // Gets the set of language codes that can be used as UI language. | 55 // Gets the set of language codes that can be used as UI language. |
52 // The return value will look like: | 56 // The return value will look like: |
53 // {'en-US': true, 'fi': true, 'fr': true, ...} | 57 // {'en-US': true, 'fi': true, 'fr': true, ...} |
54 // | 58 // |
55 // Note that true in values does not mean anything. We just use the | 59 // Note that true in values does not mean anything. We just use the |
56 // dictionary as a set. | 60 // dictionary as a set. |
57 static DictionaryValue* GetUiLanguageCodeSet(); | 61 static DictionaryValue* GetUILanguageCodeSet(); |
58 | 62 |
59 // Gets the set of language codes that can be used for spellchecking. | 63 // Gets the set of language codes that can be used for spellchecking. |
60 // The return value will look like: | 64 // The return value will look like: |
61 // {'en-US': true, 'fi': true, 'fr': true, ...} | 65 // {'en-US': true, 'fi': true, 'fr': true, ...} |
62 // | 66 // |
63 // Note that true in values does not mean anything. We just use the | 67 // Note that true in values does not mean anything. We just use the |
64 // dictionary as a set. | 68 // dictionary as a set. |
65 static DictionaryValue* GetSpellCheckLanguageCodeSet(); | 69 static DictionaryValue* GetSpellCheckLanguageCodeSet(); |
66 | 70 |
67 private: | 71 private: |
| 72 #if defined(OS_CHROMEOS) |
68 // Called when the input method is disabled. | 73 // Called when the input method is disabled. |
69 // |args| will contain the input method ID as string (ex. "mozc"). | 74 // |args| will contain the input method ID as string (ex. "mozc"). |
70 void InputMethodDisableCallback(const ListValue* args); | 75 void InputMethodDisableCallback(const ListValue* args); |
71 | 76 |
72 // Called when the input method is enabled. | 77 // Called when the input method is enabled. |
73 // |args| will contain the input method ID as string (ex. "mozc"). | 78 // |args| will contain the input method ID as string (ex. "mozc"). |
74 void InputMethodEnableCallback(const ListValue* args); | 79 void InputMethodEnableCallback(const ListValue* args); |
75 | 80 |
76 // Called when the input method options page is opened. | 81 // Called when the input method options page is opened. |
77 // |args| will contain the input method ID as string (ex. "mozc"). | 82 // |args| will contain the input method ID as string (ex. "mozc"). |
78 void InputMethodOptionsOpenCallback(const ListValue* args); | 83 void InputMethodOptionsOpenCallback(const ListValue* args); |
| 84 #endif // defined(OS_CHROMEOS) |
79 | 85 |
80 // Called when the language options is opened. | 86 // Called when the language options is opened. |
81 void LanguageOptionsOpenCallback(const ListValue* args); | 87 void LanguageOptionsOpenCallback(const ListValue* args); |
82 | 88 |
83 // Called when the UI language is changed. | 89 // Called when the UI language is changed. |
84 // |args| will contain the language code as string (ex. "fr"). | 90 // |args| will contain the language code as string (ex. "fr"). |
85 void UiLanguageChangeCallback(const ListValue* args); | 91 void UiLanguageChangeCallback(const ListValue* args); |
86 | 92 |
87 // Called when the spell check language is changed. | 93 // Called when the spell check language is changed. |
88 // |args| will contain the language code as string (ex. "fr"). | 94 // |args| will contain the language code as string (ex. "fr"). |
89 void SpellCheckLanguageChangeCallback(const ListValue* args); | 95 void SpellCheckLanguageChangeCallback(const ListValue* args); |
90 | 96 |
91 // Called when the sign out button is clicked. | 97 // Called when the restart/sign-out button is clicked. |
92 void SignOutCallback(const ListValue* args); | 98 void RestartCallback(const ListValue* args); |
93 | 99 |
94 DISALLOW_COPY_AND_ASSIGN(LanguageOptionsHandler); | 100 DISALLOW_COPY_AND_ASSIGN(LanguageOptionsHandler); |
95 }; | 101 }; |
96 | 102 |
97 } // namespace | |
98 | |
99 #endif // OS_CHROMEOS | |
100 | |
101 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ | 103 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ |
102 | |
OLD | NEW |