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