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