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 "ui/base/ime/chromeos/component_extension_ime_manager.h"
14 #include "ui/base/ime/chromeos/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 ~CrosLanguageOptionsHandler() override
;
27 // OptionsPageUIHandler implementation.
28 void GetLocalizedValues(base::DictionaryValue
* localized_strings
) override
;
30 // DOMMessageHandler implementation.
31 void RegisterMessages() override
;
33 // The following static methods are public for ease of testing.
35 // Gets the list of supported input methods.
36 // The return value will look like:
37 // [{'id': 'pinyin', 'displayName': 'Pinyin',
38 // 'languageCodeSet': {'zh-CW': true}}, ...]
40 // Note that true in languageCodeSet does not mean anything. We just use
41 // the dictionary as a set.
42 static base::ListValue
* GetInputMethodList();
44 // Converts input method descriptors to the list of input methods.
45 // The return value will look like:
46 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest',
47 // 'displayName': 'Sample IME'}, ...]
48 static base::ListValue
* ConvertInputMethodDescriptorsToIMEList(
49 const input_method::InputMethodDescriptors
& descriptors
);
52 // LanguageOptionsHandlerCommon implementation.
53 base::string16
GetProductName() override
;
54 void SetApplicationLocale(const std::string
& language_code
) override
;
56 // Called when the sign-out button is clicked.
57 void RestartCallback(const base::ListValue
* args
);
59 // Called when the input method is disabled.
60 // |args| will contain the input method ID as string (ex. "mozc").
61 void InputMethodDisableCallback(const base::ListValue
* args
);
63 // Called when the input method is enabled.
64 // |args| will contain the input method ID as string (ex. "mozc").
65 void InputMethodEnableCallback(const base::ListValue
* args
);
67 // Called when the input method options page is opened.
68 // |args| will contain the input method ID as string (ex. "mozc").
69 void InputMethodOptionsOpenCallback(const base::ListValue
* args
);
71 // Adds the name of the extension that provides the IME to each entry in the
72 // |list| of extension IMEs.
73 void AddImeProvider(base::ListValue
* list
);
75 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler
);
78 } // namespace options
79 } // namespace chromeos
81 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H_