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