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