Chromium Code Reviews| Index: chrome/browser/ui/webui/options/language_dictionary_overlay_handler.h |
| diff --git a/chrome/browser/ui/webui/options/language_dictionary_overlay_handler.h b/chrome/browser/ui/webui/options/language_dictionary_overlay_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8edfdaa28eab42175c51a9b269ad3ce79aa47432 |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/options/language_dictionary_overlay_handler.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H_ |
| +#define CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H_ |
| + |
| +#include "chrome/browser/ui/webui/options/options_ui.h" |
| +#include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" |
|
csilv
2012/11/14 20:01:52
nit: order includes in alphabetical order.
please use gerrit instead
2012/11/14 22:54:46
Done.
|
| + |
| +namespace options { |
| + |
| +class LanguageDictionaryOverlayHandler |
| + : public OptionsPageUIHandler, |
| + public SpellcheckCustomDictionary::Observer { |
| + public: |
| + LanguageDictionaryOverlayHandler(); |
| + virtual ~LanguageDictionaryOverlayHandler(); |
| + |
| + // Overridden from OptionsPageUIHandler: |
| + virtual void GetLocalizedValues( |
| + base::DictionaryValue* localized_strings) OVERRIDE; |
| + virtual void InitializeHandler() OVERRIDE; |
| + virtual void InitializePage() OVERRIDE; |
| + virtual void RegisterMessages() OVERRIDE; |
| + virtual void Uninitialize() OVERRIDE; |
| + |
| + // Overridden from SpellcheckCustomDictionary::Observer: |
| + virtual void OnCustomDictionaryLoaded() OVERRIDE; |
| + virtual void OnCustomDictionaryWordAdded(const std::string& word) OVERRIDE; |
| + virtual void OnCustomDictionaryWordRemoved(const std::string& word) OVERRIDE; |
| + |
| + private: |
| + // Calls WebUI to update the dictionary words. |
| + void UpdateWordList(); |
| + |
| + // Loads the spellchecker. Returns true if the spellchecker is ready to use, |
| + // otherwise returns false. |
| + bool LoadSpellchecker(); |
| + |
| + // Refreshes the dictionary words. Called from WebUI. |
| + void RefreshWords(const base::ListValue* args); |
| + |
| + // Replaces an old word with a new word. Either word can be empty. Called from |
| + // WebUI. |
| + void EditWord(const base::ListValue* args); |
| + |
| + // Whether the overlay is initialized and ready to show data. |
| + bool overlay_initialized_; |
| + |
| + SpellcheckCustomDictionary* dictionary_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(LanguageDictionaryOverlayHandler); |
| +}; |
| + |
| +} // namespace options |
| + |
| +#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H_ |