Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6537)

Unified Diff: chrome/browser/ui/webui/options/language_dictionary_overlay_handler.h

Issue 11362063: Editing the custom spelling dictionary (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Exclude custom dictionary WebUI from mac Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..4c9fae2260d40b873d37ed855056877902b72687
--- /dev/null
+++ b/chrome/browser/ui/webui/options/language_dictionary_overlay_handler.h
@@ -0,0 +1,60 @@
+// 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/spellchecker/spellcheck_custom_dictionary.h"
+#include "chrome/browser/ui/webui/options/options_ui.h"
+
+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:
+ // Resets the data model with the words from the dictionary.
+ void ResetDataModel();
+
+ // Calls WebUI to update the dictionary words.
+ void UpdateWordList();
+
+ // Refreshes the dictionary words. Called from WebUI.
+ void RefreshWords(const base::ListValue* args);
+
+ // Adds a new word to the dictionary. Called from WebUI.
+ void AddWord(const base::ListValue* args);
+
+ // Removes a word from the dictionary. Called from WebUI.
+ void RemoveWord(const base::ListValue* args);
+
+ // Whether the overlay is initialized and ready to show data.
+ bool overlay_initialized_;
+
+ SpellcheckCustomDictionary* dictionary_;
+ std::vector<std::string> data_model_;
+
+ DISALLOW_COPY_AND_ASSIGN(LanguageDictionaryOverlayHandler);
+};
+
+} // namespace options
+
+#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_DICTIONARY_OVERLAY_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698