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