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

Unified Diff: chrome/renderer/spellchecker/spellcheck_provider.h

Issue 6392045: Integrating Mac OS Grammar checker into Chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the feedback from jam@. Created 9 years, 10 months 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/renderer/spellchecker/spellcheck_provider.h
diff --git a/chrome/renderer/spellchecker/spellcheck_provider.h b/chrome/renderer/spellchecker/spellcheck_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..e7463a78f690d97c2a99d11323ab795c44a5120e
--- /dev/null
+++ b/chrome/renderer/spellchecker/spellcheck_provider.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2010 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_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_H_
+#define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_H_
+#pragma once
+
+#include <vector>
+
+#include "base/id_map.h"
+#include "chrome/renderer/render_view_observer.h"
+
+class RenderView;
+class SpellCheck;
+
+namespace WebKit {
+class WebString;
+class WebTextCheckingResult;
+class WebTextCheckingCompletion;
+}
+
+// This class deals with invoking browser-side spellcheck mechanism
+// which is done asynchronously.
+class SpellCheckProvider : public RenderViewObserver {
Hironori Bono 2011/02/18 11:09:27 I'm a little wondering if this name describes the
+ public:
+ typedef IDMap<WebKit::WebTextCheckingCompletion> WebTextCheckCompletions;
+
+ SpellCheckProvider(RenderView* render_view, SpellCheck* spellcheck);
+ virtual ~SpellCheckProvider();
+
+ void RequestTextChecking(
+ const WebKit::WebString& text,
+ int document_tag,
+ WebKit::WebTextCheckingCompletion* completion);
+
+ void OnSpellCheckerRespondTextCheck(
+ int identifier,
+ int tag,
+ const std::vector<WebKit::WebTextCheckingResult>& results);
+
+ // Check the availability of the platform spellchecker.
+ // Makes this virtual for overriding on the unittest.
+ virtual bool is_using_platform_spelling_engine() const;
+
+ size_t pending_text_request_size() const {
+ return text_check_completions_.size();
+ }
+
+ // RenderViewObserver implementation.
+ virtual bool OnMessageReceived(const IPC::Message& message);
+
+ private:
+ // Holds ongoing spellchecking operations, assigns IDs for the IPC routing.
+ WebTextCheckCompletions text_check_completions_;
+ // Spellcheck implementation for use. Weak reference.
+ SpellCheck* spellcheck_;
+
+ DISALLOW_COPY_AND_ASSIGN(SpellCheckProvider);
+};
+
+#endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698