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.
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_
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "chrome/browser/ui/webui/options/language_options_handler.h"
13 #include "chromeos/ime/component_extension_ime_manager.h"
14 #include "chromeos/ime/input_method_descriptor.h"
19 // Language options page UI handler for Chrome OS. For non-Chrome OS,
20 // see LanguageOptionsHnadler.
21 class CrosLanguageOptionsHandler
22 : public ::options::LanguageOptionsHandlerCommon {
24 CrosLanguageOptionsHandler();
25 virtual ~CrosLanguageOptionsHandler();
27 // OptionsPageUIHandler implementation.
28 virtual void GetLocalizedValues(
29 base::DictionaryValue* localized_strings) OVERRIDE;
31 // DOMMessageHandler implementation.
32 virtual void RegisterMessages() OVERRIDE;
34 // The following static methods are public for ease of testing.
36 // Gets the list of supported input methods.
37 // The return value will look like:
38 // [{'id': 'pinyin', 'displayName': 'Pinyin',
39 // 'languageCodeSet': {'zh-CW': true}}, ...]
41 // Note that true in languageCodeSet does not mean anything. We just use
42 // the dictionary as a set.
43 static base::ListValue* GetInputMethodList();
45 // Converts input method descriptors to the list of input methods.
46 // The return value will look like:
47 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest',
48 // 'displayName': 'Sample IME'}, ...]
49 static base::ListValue* ConvertInputMethodDescriptorsToIMEList(
50 const input_method::InputMethodDescriptors& descriptors);
53 // LanguageOptionsHandlerCommon implementation.
54 virtual base::string16 GetProductName() OVERRIDE;
55 virtual void SetApplicationLocale(const std::string& language_code) OVERRIDE;
57 // Called when the sign-out button is clicked.
58 void RestartCallback(const base::ListValue* args);
60 // Called when the input method is disabled.
61 // |args| will contain the input method ID as string (ex. "mozc").
62 void InputMethodDisableCallback(const base::ListValue* args);
64 // Called when the input method is enabled.
65 // |args| will contain the input method ID as string (ex. "mozc").
66 void InputMethodEnableCallback(const base::ListValue* args);
68 // Called when the input method options page is opened.
69 // |args| will contain the input method ID as string (ex. "mozc").
70 void InputMethodOptionsOpenCallback(const base::ListValue* args);
72 // Adds the name of the extension that provides the IME to each entry in the
73 // |list| of extension IMEs.
74 void AddImeProvider(base::ListValue* list);
76 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler);
79 } // namespace options
80 } // namespace chromeos
82 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H_