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