| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H_ |
| 7 |
| 8 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" |
| 9 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 10 |
| 11 namespace options { |
| 12 |
| 13 class LanguageDictionaryOverlayHandler |
| 14 : public OptionsPageUIHandler, |
| 15 public SpellcheckCustomDictionary::Observer { |
| 16 public: |
| 17 LanguageDictionaryOverlayHandler(); |
| 18 virtual ~LanguageDictionaryOverlayHandler(); |
| 19 |
| 20 // Overridden from OptionsPageUIHandler: |
| 21 virtual void GetLocalizedValues( |
| 22 base::DictionaryValue* localized_strings) OVERRIDE; |
| 23 virtual void InitializeHandler() OVERRIDE; |
| 24 virtual void InitializePage() OVERRIDE; |
| 25 virtual void RegisterMessages() OVERRIDE; |
| 26 virtual void Uninitialize() OVERRIDE; |
| 27 |
| 28 // Overridden from SpellcheckCustomDictionary::Observer: |
| 29 virtual void OnCustomDictionaryLoaded() OVERRIDE; |
| 30 virtual void OnCustomDictionaryWordAdded(const std::string& word) OVERRIDE; |
| 31 virtual void OnCustomDictionaryWordRemoved(const std::string& word) OVERRIDE; |
| 32 |
| 33 private: |
| 34 // Resets the data model with the words from the dictionary. |
| 35 void ResetDataModel(); |
| 36 |
| 37 // Calls WebUI to update the dictionary words. |
| 38 void UpdateWordList(); |
| 39 |
| 40 // Refreshes the dictionary words. Called from WebUI. |
| 41 void RefreshWords(const base::ListValue* args); |
| 42 |
| 43 // Adds a new word to the dictionary. Called from WebUI. |
| 44 void AddWord(const base::ListValue* args); |
| 45 |
| 46 // Removes a word from the dictionary. Called from WebUI. |
| 47 void RemoveWord(const base::ListValue* args); |
| 48 |
| 49 // Whether the overlay is initialized and ready to show data. |
| 50 bool overlay_initialized_; |
| 51 |
| 52 SpellcheckCustomDictionary* dictionary_; |
| 53 std::vector<std::string> data_model_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(LanguageDictionaryOverlayHandler); |
| 56 }; |
| 57 |
| 58 } // namespace options |
| 59 |
| 60 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H
_ |
| OLD | NEW |