| 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 virtual ~LanguageDictionaryOverlayHandler(); |
| 19 | 19 |
| 20 // Overridden from OptionsPageUIHandler: | 20 // Overridden from OptionsPageUIHandler: |
| 21 virtual void GetLocalizedValues( | 21 virtual void GetLocalizedValues( |
| 22 base::DictionaryValue* localized_strings) OVERRIDE; | 22 base::DictionaryValue* localized_strings) OVERRIDE; |
| 23 virtual void InitializeHandler() OVERRIDE; | 23 virtual void InitializeHandler() OVERRIDE; |
| 24 virtual void InitializePage() OVERRIDE; | 24 virtual void InitializePage() OVERRIDE; |
| 25 virtual void RegisterMessages() OVERRIDE; | 25 virtual void RegisterMessages() OVERRIDE; |
| 26 virtual void Uninitialize() OVERRIDE; | 26 virtual void Uninitialize() OVERRIDE; |
| 27 | 27 |
| 28 // Overridden from SpellcheckCustomDictionary::Observer: | 28 // Overridden from SpellcheckCustomDictionary::Observer: |
| 29 virtual void OnCustomDictionaryLoaded() OVERRIDE; | 29 virtual void OnCustomDictionaryLoaded() OVERRIDE; |
| 30 virtual void OnCustomDictionaryWordAdded(const std::string& word) OVERRIDE; | 30 virtual void OnCustomDictionaryChanged( |
| 31 virtual void OnCustomDictionaryWordRemoved(const std::string& word) OVERRIDE; | 31 const SpellcheckCustomDictionary::Change& dictionary_change) OVERRIDE; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 // Sends the dictionary words to WebUI. | 34 // Sends the dictionary words to WebUI. |
| 35 void ResetDictionaryWords(); | 35 void ResetDictionaryWords(); |
| 36 | 36 |
| 37 // Refreshes the displayed words. Called from WebUI. | 37 // Refreshes the displayed words. Called from WebUI. |
| 38 void RefreshWords(const base::ListValue* args); | 38 void RefreshWords(const base::ListValue* args); |
| 39 | 39 |
| 40 // Adds a new word to the dictionary. Called from WebUI. | 40 // Adds a new word to the dictionary. Called from WebUI. |
| 41 void AddWord(const base::ListValue* args); | 41 void AddWord(const base::ListValue* args); |
| 42 | 42 |
| 43 // Removes a word from the dictionary. Called from WebUI. | 43 // Removes a word from the dictionary. Called from WebUI. |
| 44 void RemoveWord(const base::ListValue* args); | 44 void RemoveWord(const base::ListValue* args); |
| 45 | 45 |
| 46 // Whether the overlay is initialized and ready to show data. | 46 // Whether the overlay is initialized and ready to show data. |
| 47 bool overlay_initialized_; | 47 bool overlay_initialized_; |
| 48 | 48 |
| 49 // The custom spelling dictionary. Used for adding, removing, and reading | 49 // The custom spelling dictionary. Used for adding, removing, and reading |
| 50 // words in custom dictionary file. | 50 // words in custom dictionary file. |
| 51 SpellcheckCustomDictionary* dictionary_; | 51 SpellcheckCustomDictionary* dictionary_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(LanguageDictionaryOverlayHandler); | 53 DISALLOW_COPY_AND_ASSIGN(LanguageDictionaryOverlayHandler); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace options | 56 } // namespace options |
| 57 | 57 |
| 58 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H
_ | 58 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H
_ |
| OLD | NEW |