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