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