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

Unified Diff: chrome/browser/renderer_host/resource_message_filter.cc

Issue 160565: Adds support for the os x spelling panel to chromium. Users can... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.h ('k') | chrome/browser/spellcheck_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/resource_message_filter.cc
===================================================================
--- chrome/browser/renderer_host/resource_message_filter.cc (revision 25643)
+++ chrome/browser/renderer_host/resource_message_filter.cc (working copy)
@@ -27,6 +27,7 @@
#include "chrome/browser/renderer_host/file_system_accessor.h"
#include "chrome/browser/renderer_host/render_widget_helper.h"
#include "chrome/browser/spellchecker.h"
+#include "chrome/browser/spellchecker_platform_engine.h"
#include "chrome/browser/worker_host/message_port_dispatcher.h"
#include "chrome/browser/worker_host/worker_service.h"
#include "chrome/common/appcache/appcache_dispatcher_host.h"
@@ -296,8 +297,15 @@
IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToWorker,
OnForwardToWorker)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SpellCheck, OnSpellCheck)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetDocumentTag,
+ OnGetDocumentTag)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentWithTagClosed,
+ OnDocumentWithTagClosed)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetAutoCorrectWord,
OnGetAutoCorrectWord)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ShowSpellingPanel, OnShowSpellingPanel)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateSpellingPanelWithMisspelledWord,
+ OnUpdateSpellingPanelWithMisspelledWord)
IPC_MESSAGE_HANDLER(ViewHostMsg_DnsPrefetch, OnDnsPrefetch)
IPC_MESSAGE_HANDLER(ViewHostMsg_RendererHistograms,
OnRendererHistograms)
@@ -376,7 +384,7 @@
int misspell_location, misspell_length;
bool is_misspelled = !spellchecker_->SpellCheckWord(
params.misspelled_word.c_str(),
- static_cast<int>(params.misspelled_word.length()),
+ static_cast<int>(params.misspelled_word.length()), 0,
&misspell_location, &misspell_length,
&params.dictionary_suggestions);
@@ -868,14 +876,14 @@
// spellings are correct.
//
// Note: This is called in the IO thread.
-void ResourceMessageFilter::OnSpellCheck(const std::wstring& word,
+void ResourceMessageFilter::OnSpellCheck(const std::wstring& word, int tag,
IPC::Message* reply_msg) {
int misspell_location = 0;
int misspell_length = 0;
if (spellchecker_ != NULL) {
spellchecker_->SpellCheckWord(word.c_str(),
- static_cast<int>(word.length()),
+ static_cast<int>(word.length()), tag,
&misspell_location, &misspell_length, NULL);
}
@@ -885,12 +893,23 @@
return;
}
+void ResourceMessageFilter::OnGetDocumentTag(IPC::Message* reply_msg) {
+ int tag = SpellCheckerPlatform::GetDocumentTag();
+ ViewHostMsg_GetDocumentTag::WriteReplyParams(reply_msg, tag);
+ Send(reply_msg);
+ return;
+}
+void ResourceMessageFilter::OnDocumentWithTagClosed(int tag) {
+ SpellCheckerPlatform::CloseDocumentWithTag(tag);
+}
+
void ResourceMessageFilter::OnGetAutoCorrectWord(const std::wstring& word,
+ int tag,
IPC::Message* reply_msg) {
std::wstring autocorrect_word;
if (spellchecker_ != NULL) {
- spellchecker_->GetAutoCorrectionWord(word, &autocorrect_word);
+ spellchecker_->GetAutoCorrectionWord(word, tag, &autocorrect_word);
}
ViewHostMsg_GetAutoCorrectWord::WriteReplyParams(reply_msg,
@@ -899,6 +918,15 @@
return;
}
+void ResourceMessageFilter::OnShowSpellingPanel(bool show) {
+ SpellCheckerPlatform::ShowSpellingPanel(show);
+}
+
+void ResourceMessageFilter::OnUpdateSpellingPanelWithMisspelledWord(
+ const std::wstring& word) {
+ SpellCheckerPlatform::UpdateSpellingPanelWithMisspelledWord(word);
+}
+
void ResourceMessageFilter::Observe(NotificationType type,
const NotificationSource &source,
const NotificationDetails &details) {
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.h ('k') | chrome/browser/spellcheck_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698