OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 7 |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | 8 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" | 10 #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" |
13 #include "chrome/browser/ui/webui/options/options_ui.h" | 11 #include "chrome/browser/ui/webui/options/options_ui.h" |
14 | 12 |
15 namespace base { | 13 namespace base { |
16 class DictionaryValue; | 14 class DictionaryValue; |
17 class ListValue; | 15 class ListValue; |
18 } | 16 } |
19 | 17 |
(...skipping 24 matching lines...) Expand all Loading... |
44 const std::string& language) override; | 42 const std::string& language) override; |
45 | 43 |
46 // The following static methods are public for ease of testing. | 44 // The following static methods are public for ease of testing. |
47 | 45 |
48 // Gets the set of language codes that can be used as UI language. | 46 // Gets the set of language codes that can be used as UI language. |
49 // The return value will look like: | 47 // The return value will look like: |
50 // {'en-US': true, 'fi': true, 'fr': true, ...} | 48 // {'en-US': true, 'fi': true, 'fr': true, ...} |
51 // | 49 // |
52 // Note that true in values does not mean anything. We just use the | 50 // Note that true in values does not mean anything. We just use the |
53 // dictionary as a set. | 51 // dictionary as a set. |
54 static std::unique_ptr<base::DictionaryValue> GetUILanguageCodeSet(); | 52 static base::DictionaryValue* GetUILanguageCodeSet(); |
55 | 53 |
56 // Gets the set of language codes that can be used for spellchecking. | 54 // Gets the set of language codes that can be used for spellchecking. |
57 // The return value will look like: | 55 // The return value will look like: |
58 // {'en-US': true, 'fi': true, 'fr': true, ...} | 56 // {'en-US': true, 'fi': true, 'fr': true, ...} |
59 // | 57 // |
60 // Note that true in values does not mean anything. We just use the | 58 // Note that true in values does not mean anything. We just use the |
61 // dictionary as a set. | 59 // dictionary as a set. |
62 static std::unique_ptr<base::DictionaryValue> GetSpellCheckLanguageCodeSet(); | 60 static base::DictionaryValue* GetSpellCheckLanguageCodeSet(); |
63 | 61 |
64 private: | 62 private: |
65 // Sets the application locale. | 63 // Sets the application locale. |
66 virtual void SetApplicationLocale(const std::string& language_code) = 0; | 64 virtual void SetApplicationLocale(const std::string& language_code) = 0; |
67 | 65 |
68 // Called when the language options is opened. | 66 // Called when the language options is opened. |
69 void LanguageOptionsOpenCallback(const base::ListValue* args); | 67 void LanguageOptionsOpenCallback(const base::ListValue* args); |
70 | 68 |
71 // Called when the UI language is changed. | 69 // Called when the UI language is changed. |
72 // |args| will contain the language code as string (ex. "fr"). | 70 // |args| will contain the language code as string (ex. "fr"). |
(...skipping 14 matching lines...) Expand all Loading... |
87 // Returns a pointer to the browser SpellcheckService. Can be null if the | 85 // Returns a pointer to the browser SpellcheckService. Can be null if the |
88 // service has already shut down. | 86 // service has already shut down. |
89 SpellcheckService* GetSpellcheckService(); | 87 SpellcheckService* GetSpellcheckService(); |
90 | 88 |
91 DISALLOW_COPY_AND_ASSIGN(LanguageOptionsHandlerCommon); | 89 DISALLOW_COPY_AND_ASSIGN(LanguageOptionsHandlerCommon); |
92 }; | 90 }; |
93 | 91 |
94 } // namespace options | 92 } // namespace options |
95 | 93 |
96 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_COMMON_H_ | 94 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_COMMON_H_ |
OLD | NEW |