OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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_OPTIONS2_LANGUAGE_OPTIONS_HANDLER_COMMON2_H_ | |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_LANGUAGE_OPTIONS_HANDLER_COMMON2_H_ | |
7 #pragma once | |
8 | |
9 #include "chrome/browser/ui/webui/options2/options_ui2.h" | |
10 | |
11 namespace base { | |
12 class DictionaryValue; | |
13 class ListValue; | |
14 } | |
15 | |
16 namespace options2 { | |
17 | |
18 // The base class for language options page UI handlers. This class has code | |
19 // common to the Chrome OS and non-Chrome OS implementation of the handler. | |
20 class LanguageOptionsHandlerCommon : public OptionsPageUIHandler { | |
21 public: | |
22 LanguageOptionsHandlerCommon(); | |
23 virtual ~LanguageOptionsHandlerCommon(); | |
24 | |
25 // OptionsPageUIHandler implementation. | |
26 virtual void GetLocalizedValues( | |
27 base::DictionaryValue* localized_strings) OVERRIDE; | |
28 | |
29 // DOMMessageHandler implementation. | |
30 virtual void RegisterMessages() OVERRIDE; | |
31 | |
32 // The following static methods are public for ease of testing. | |
33 | |
34 // Gets the set of language codes that can be used as UI language. | |
35 // The return value will look like: | |
36 // {'en-US': true, 'fi': true, 'fr': true, ...} | |
37 // | |
38 // Note that true in values does not mean anything. We just use the | |
39 // dictionary as a set. | |
40 static base::DictionaryValue* GetUILanguageCodeSet(); | |
41 | |
42 // Gets the set of language codes that can be used for spellchecking. | |
43 // The return value will look like: | |
44 // {'en-US': true, 'fi': true, 'fr': true, ...} | |
45 // | |
46 // Note that true in values does not mean anything. We just use the | |
47 // dictionary as a set. | |
48 static base::DictionaryValue* GetSpellCheckLanguageCodeSet(); | |
49 | |
50 private: | |
51 // Returns the name of the product (ex. "Chrome" or "Chrome OS"). | |
52 virtual string16 GetProductName() = 0; | |
53 | |
54 // Sets the application locale. | |
55 virtual void SetApplicationLocale(const std::string& language_code) = 0; | |
56 | |
57 // Called when the language options is opened. | |
58 void LanguageOptionsOpenCallback(const base::ListValue* args); | |
59 | |
60 // Called when the UI language is changed. | |
61 // |args| will contain the language code as string (ex. "fr"). | |
62 void UiLanguageChangeCallback(const base::ListValue* args); | |
63 | |
64 // Called when the spell check language is changed. | |
65 // |args| will contain the language code as string (ex. "fr"). | |
66 void SpellCheckLanguageChangeCallback(const base::ListValue* args); | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(LanguageOptionsHandlerCommon); | |
69 }; | |
70 | |
71 } // namespace options2 | |
72 | |
73 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_LANGUAGE_OPTIONS_HANDLER_COMMON2_H_ | |
OLD | NEW |