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