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