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_DICTIONARY_OVERLAY_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H_ |
7 | 7 |
8 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" | 8 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" |
9 #include "chrome/browser/ui/webui/options/options_ui.h" | 9 #include "chrome/browser/ui/webui/options/options_ui.h" |
10 | 10 |
11 namespace options { | 11 namespace options { |
12 | 12 |
13 class LanguageDictionaryOverlayHandler | 13 class LanguageDictionaryOverlayHandler |
14 : public OptionsPageUIHandler, | 14 : public OptionsPageUIHandler, |
15 public SpellcheckCustomDictionary::Observer { | 15 public SpellcheckCustomDictionary::Observer { |
16 public: | 16 public: |
17 LanguageDictionaryOverlayHandler(); | 17 LanguageDictionaryOverlayHandler(); |
18 virtual ~LanguageDictionaryOverlayHandler(); | 18 ~LanguageDictionaryOverlayHandler() override; |
19 | 19 |
20 // Overridden from OptionsPageUIHandler: | 20 // Overridden from OptionsPageUIHandler: |
21 virtual void GetLocalizedValues( | 21 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
22 base::DictionaryValue* localized_strings) override; | 22 void RegisterMessages() override; |
23 virtual void RegisterMessages() override; | 23 void Uninitialize() override; |
24 virtual void Uninitialize() override; | |
25 | 24 |
26 // Overridden from SpellcheckCustomDictionary::Observer: | 25 // Overridden from SpellcheckCustomDictionary::Observer: |
27 virtual void OnCustomDictionaryLoaded() override; | 26 void OnCustomDictionaryLoaded() override; |
28 virtual void OnCustomDictionaryChanged( | 27 void OnCustomDictionaryChanged( |
29 const SpellcheckCustomDictionary::Change& dictionary_change) override; | 28 const SpellcheckCustomDictionary::Change& dictionary_change) override; |
30 | 29 |
31 private: | 30 private: |
32 // Sends the dictionary words to WebUI. | 31 // Sends the dictionary words to WebUI. |
33 void ResetDictionaryWords(); | 32 void ResetDictionaryWords(); |
34 | 33 |
35 // Refreshes the displayed words. Called from WebUI. | 34 // Refreshes the displayed words. Called from WebUI. |
36 void RefreshWords(const base::ListValue* args); | 35 void RefreshWords(const base::ListValue* args); |
37 | 36 |
38 // Adds a new word to the dictionary. Called from WebUI. | 37 // Adds a new word to the dictionary. Called from WebUI. |
39 void AddWord(const base::ListValue* args); | 38 void AddWord(const base::ListValue* args); |
40 | 39 |
41 // Removes a word from the dictionary. Called from WebUI. | 40 // Removes a word from the dictionary. Called from WebUI. |
42 void RemoveWord(const base::ListValue* args); | 41 void RemoveWord(const base::ListValue* args); |
43 | 42 |
44 // Whether the overlay is initialized and ready to show data. | 43 // Whether the overlay is initialized and ready to show data. |
45 bool overlay_initialized_; | 44 bool overlay_initialized_; |
46 | 45 |
47 // The custom spelling dictionary. Used for adding, removing, and reading | 46 // The custom spelling dictionary. Used for adding, removing, and reading |
48 // words in custom dictionary file. | 47 // words in custom dictionary file. |
49 SpellcheckCustomDictionary* dictionary_; | 48 SpellcheckCustomDictionary* dictionary_; |
50 | 49 |
51 DISALLOW_COPY_AND_ASSIGN(LanguageDictionaryOverlayHandler); | 50 DISALLOW_COPY_AND_ASSIGN(LanguageDictionaryOverlayHandler); |
52 }; | 51 }; |
53 | 52 |
54 } // namespace options | 53 } // namespace options |
55 | 54 |
56 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H
_ | 55 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H
_ |
OLD | NEW |