Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / options / chromeos / cros_language_options_handler.h
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_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H_
7
8 #include <string>
9
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"
15
16 namespace chromeos {
17 namespace options {
18
19 // Language options page UI handler for Chrome OS.  For non-Chrome OS,
20 // see LanguageOptionsHnadler.
21 class CrosLanguageOptionsHandler
22     : public ::options::LanguageOptionsHandlerCommon {
23  public:
24   CrosLanguageOptionsHandler();
25   virtual ~CrosLanguageOptionsHandler();
26
27   // OptionsPageUIHandler implementation.
28   virtual void GetLocalizedValues(
29       base::DictionaryValue* localized_strings) OVERRIDE;
30
31   // DOMMessageHandler implementation.
32   virtual void RegisterMessages() OVERRIDE;
33
34   // The following static methods are public for ease of testing.
35
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}},  ...]
40   //
41   // Note that true in languageCodeSet does not mean anything. We just use
42   // the dictionary as a set.
43   static base::ListValue* GetInputMethodList();
44
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);
51
52  private:
53   // LanguageOptionsHandlerCommon implementation.
54   virtual base::string16 GetProductName() OVERRIDE;
55   virtual void SetApplicationLocale(const std::string& language_code) OVERRIDE;
56
57   // Called when the sign-out button is clicked.
58   void RestartCallback(const base::ListValue* args);
59
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);
63
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);
67
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);
71
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);
75
76   DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler);
77 };
78
79 }  // namespace options
80 }  // namespace chromeos
81
82 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H_