Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / language_dictionary_overlay_handler.h
blob742272f386a765ba869c29b8c4793d39bc5637ab
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 "base/macros.h"
9 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h"
10 #include "chrome/browser/ui/webui/options/options_ui.h"
12 namespace base {
13 class DictionaryValue;
14 class ListValue;
17 namespace options {
19 class LanguageDictionaryOverlayHandler
20 : public OptionsPageUIHandler,
21 public SpellcheckCustomDictionary::Observer {
22 public:
23 LanguageDictionaryOverlayHandler();
24 ~LanguageDictionaryOverlayHandler() override;
26 // Overridden from OptionsPageUIHandler:
27 void GetLocalizedValues(base::DictionaryValue* localized_strings) override;
28 void RegisterMessages() override;
29 void Uninitialize() override;
31 // Overridden from SpellcheckCustomDictionary::Observer:
32 void OnCustomDictionaryLoaded() override;
33 void OnCustomDictionaryChanged(
34 const SpellcheckCustomDictionary::Change& dictionary_change) override;
36 private:
37 // Sends the dictionary words to WebUI.
38 void ResetDictionaryWords();
40 // Refreshes the displayed words. Called from WebUI.
41 void RefreshWords(const base::ListValue* args);
43 // Adds a new word to the dictionary. Called from WebUI.
44 void AddWord(const base::ListValue* args);
46 // Removes a word from the dictionary. Called from WebUI.
47 void RemoveWord(const base::ListValue* args);
49 // Whether the overlay is initialized and ready to show data.
50 bool overlay_initialized_;
52 // The custom spelling dictionary. Used for adding, removing, and reading
53 // words in custom dictionary file.
54 SpellcheckCustomDictionary* dictionary_;
56 DISALLOW_COPY_AND_ASSIGN(LanguageDictionaryOverlayHandler);
59 } // namespace options
61 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H_