Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / chromeos / cros_language_options_handler.h
blob32bf026b16a7813b834a4d6357f6277148c1ce0d
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_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/ui/webui/options/language_options_handler.h"
10 #include "chromeos/ime/component_extension_ime_manager.h"
11 #include "chromeos/ime/input_method_descriptor.h"
13 namespace chromeos {
14 namespace options {
16 // Language options page UI handler for Chrome OS. For non-Chrome OS,
17 // see LanguageOptionsHnadler.
18 class CrosLanguageOptionsHandler
19 : public ::options::LanguageOptionsHandlerCommon,
20 public ComponentExtensionIMEManager::Observer {
21 public:
22 CrosLanguageOptionsHandler();
23 virtual ~CrosLanguageOptionsHandler();
25 // OptionsPageUIHandler implementation.
26 virtual void GetLocalizedValues(
27 base::DictionaryValue* localized_strings) OVERRIDE;
29 // DOMMessageHandler implementation.
30 virtual void RegisterMessages() OVERRIDE;
32 // The following static methods are public for ease of testing.
34 // Gets the list of input methods from the given input descriptors.
35 // The return value will look like:
36 // [{'id': 'pinyin', 'displayName': 'Pinyin',
37 // 'languageCodeSet': {'zh-CW': true}}, ...]
39 // Note that true in languageCodeSet does not mean anything. We just use
40 // the dictionary as a set.
41 static base::ListValue* GetInputMethodList(
42 const input_method::InputMethodDescriptors& descriptors);
44 // Gets the list of accept languages with the given input descriptors.
45 // Listed languages will be used as Accept-Language header.
46 // The return value will look like:
47 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'},
48 // ...]
49 static base::ListValue* GetAcceptLanguageList(
50 const input_method::InputMethodDescriptors& descriptors);
52 // Gets the list of UI languages with the given input descriptors.
53 // The return value will look like:
54 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'},
55 // ...]
56 static base::ListValue* GetUILanguageList(
57 const input_method::InputMethodDescriptors& descriptors);
59 // Converts input method descriptors to the list of input methods.
60 // The return value will look like:
61 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest',
62 // 'displayName': 'Sample IME'}, ...]
63 static base::ListValue* ConvertInputMethodDescriptosToIMEList(
64 const input_method::InputMethodDescriptors& descriptors);
66 private:
67 // LanguageOptionsHandlerCommon implementation.
68 virtual base::string16 GetProductName() OVERRIDE;
69 virtual void SetApplicationLocale(const std::string& language_code) OVERRIDE;
71 // Called when the sign-out button is clicked.
72 void RestartCallback(const base::ListValue* args);
74 // Called when the input method is disabled.
75 // |args| will contain the input method ID as string (ex. "mozc").
76 void InputMethodDisableCallback(const base::ListValue* args);
78 // Called when the input method is enabled.
79 // |args| will contain the input method ID as string (ex. "mozc").
80 void InputMethodEnableCallback(const base::ListValue* args);
82 // Called when the input method options page is opened.
83 // |args| will contain the input method ID as string (ex. "mozc").
84 void InputMethodOptionsOpenCallback(const base::ListValue* args);
86 // ComponentExtensionIMEManager::Observer override.
87 virtual void OnInitialized() OVERRIDE;
89 // Gets the list of languages with |descriptors| based on
90 // |base_language_codes|.
91 static base::ListValue* GetLanguageListInternal(
92 const input_method::InputMethodDescriptors& descriptors,
93 const std::vector<std::string>& base_language_codes);
95 // OptionsPageUIHandler implementation.
96 virtual void InitializePage() OVERRIDE;
98 // True if the component extension list was appended into input method list.
99 bool composition_extension_appended_;
101 // True if this page was initialized.
102 bool is_page_initialized_;
104 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler);
107 } // namespace options
108 } // namespace chromeos
110 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H_