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

Unified Diff: chrome/renderer/render_view.cc

Issue 6392045: Integrating Mac OS Grammar checker into Chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Caught up some more missings. I'm sorry for the distraction... 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/render_view.cc
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index dcd272f37ef90031c8ec68955f54633515eaa502..7b917a96360fa0c3482982e0c295bffb26b4098d 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -147,6 +147,8 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingCompletion.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h"
@@ -260,6 +262,7 @@ using WebKit::WebSize;
using WebKit::WebStorageNamespace;
using WebKit::WebString;
using WebKit::WebTextAffinity;
+using WebKit::WebTextCheckingResult;
using WebKit::WebTextDirection;
using WebKit::WebURL;
using WebKit::WebURLError;
@@ -992,6 +995,8 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_AdvanceToNextMisspelling,
OnAdvanceToNextMisspelling)
IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellCheck, OnToggleSpellCheck)
+ IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_RespondTextCheck,
+ OnRespondTextCheck);
Hironori Bono 2011/02/10 11:02:56 nit: OnRespondTextCheck -> OnSpellCheckerRespondTe
gmorrita 2011/02/17 11:39:44 Done.
IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete)
IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll)
IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
@@ -1595,6 +1600,18 @@ void RenderView::OnToggleSpellPanel(bool is_currently_visible) {
WebString::fromUTF8("ToggleSpellPanel"));
}
+void RenderView::OnRespondTextCheck(
+ int identifier,
+ int tag,
+ const std::vector<WebTextCheckingResult>& results) {
+ WebKit::WebTextCheckingCompletion* completion =
+ text_check_completions_.Lookup(identifier);
+ if (!completion)
+ return;
+ text_check_completions_.Remove(identifier);
+ completion->didFinishCheckingText(results);
+}
+
void RenderView::OnToggleSpellCheck() {
if (!webview())
return;
@@ -2335,6 +2352,27 @@ void RenderView::spellCheck(const WebString& text,
}
}
+void RenderView::requestCheckingOfText(
+ const WebString& text,
+ WebKit::WebTextCheckingCompletion* completion) {
+ // Text check (unified request for grammar and spell check) is only
+ // available for browser process, so we do IPC instead of
+ // asking the Spellchecker.
+ int32 id = text_check_completions_.Add(completion);
+ RenderThread* thread = RenderThread::current();
+ // Will be NULL during unit tests.
+ if (thread) {
+ bool ok = thread->spellchecker()->RequestCheckingOfText(
+ routing_id_, string16(text), document_tag_, id);
+ if (ok)
+ return;
+ }
+
+ text_check_completions_.Remove(id);
+ completion->didFinishCheckingText
+ (std::vector<WebTextCheckingResult>());
+}
+
WebString RenderView::autoCorrectWord(const WebKit::WebString& word) {
string16 autocorrect_word;
const CommandLine& command_line = *CommandLine::ForCurrentProcess();

Powered by Google App Engine
This is Rietveld 408576698