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

Side by Side Diff: chrome/renderer/spellchecker/spellcheck_provider.cc

Issue 10536190: Use WebFrame::replaceMisspelledRange() to replace a misspelled range with text. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck_provider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/spellchecker/spellcheck_provider.h" 5 #include "chrome/renderer/spellchecker/spellcheck_provider.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/spellcheck_messages.h" 9 #include "chrome/common/spellcheck_messages.h"
10 #include "chrome/common/spellcheck_result.h" 10 #include "chrome/common/spellcheck_result.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 routing_id(), 159 routing_id(),
160 text_check_completions_.Add(completion), 160 text_check_completions_.Add(completion),
161 0, 161 0,
162 request)); 162 request));
163 #endif // !OS_MACOSX 163 #endif // !OS_MACOSX
164 } 164 }
165 165
166 bool SpellCheckProvider::OnMessageReceived(const IPC::Message& message) { 166 bool SpellCheckProvider::OnMessageReceived(const IPC::Message& message) {
167 bool handled = true; 167 bool handled = true;
168 IPC_BEGIN_MESSAGE_MAP(SpellCheckProvider, message) 168 IPC_BEGIN_MESSAGE_MAP(SpellCheckProvider, message)
169 IPC_MESSAGE_HANDLER(SpellCheckMsg_Replace, OnReplace)
169 #if !defined(OS_MACOSX) 170 #if !defined(OS_MACOSX)
170 IPC_MESSAGE_HANDLER(SpellCheckMsg_RespondSpellingService, 171 IPC_MESSAGE_HANDLER(SpellCheckMsg_RespondSpellingService,
171 OnRespondSpellingService) 172 OnRespondSpellingService)
172 #endif 173 #endif
173 #if defined(OS_MACOSX) 174 #if defined(OS_MACOSX)
174 IPC_MESSAGE_HANDLER(SpellCheckMsg_AdvanceToNextMisspelling, 175 IPC_MESSAGE_HANDLER(SpellCheckMsg_AdvanceToNextMisspelling,
175 OnAdvanceToNextMisspelling) 176 OnAdvanceToNextMisspelling)
176 IPC_MESSAGE_HANDLER(SpellCheckMsg_RespondTextCheck, OnRespondTextCheck) 177 IPC_MESSAGE_HANDLER(SpellCheckMsg_RespondTextCheck, OnRespondTextCheck)
177 IPC_MESSAGE_HANDLER(SpellCheckMsg_ToggleSpellPanel, OnToggleSpellPanel) 178 IPC_MESSAGE_HANDLER(SpellCheckMsg_ToggleSpellPanel, OnToggleSpellPanel)
178 #endif 179 #endif
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 280 }
280 281
281 void SpellCheckProvider::updateSpellingUIWithMisspelledWord( 282 void SpellCheckProvider::updateSpellingUIWithMisspelledWord(
282 const WebString& word) { 283 const WebString& word) {
283 #if defined(OS_MACOSX) 284 #if defined(OS_MACOSX)
284 Send(new SpellCheckHostMsg_UpdateSpellingPanelWithMisspelledWord(routing_id(), 285 Send(new SpellCheckHostMsg_UpdateSpellingPanelWithMisspelledWord(routing_id(),
285 word)); 286 word));
286 #endif 287 #endif
287 } 288 }
288 289
290 void SpellCheckProvider::OnReplace(const string16& text) {
291 if (!render_view() || !render_view()->GetWebView())
292 return;
293 render_view()->GetWebView()->focusedFrame()->replaceMisspelledRange(text);
294 }
295
289 #if !defined(OS_MACOSX) 296 #if !defined(OS_MACOSX)
290 void SpellCheckProvider::OnRespondSpellingService( 297 void SpellCheckProvider::OnRespondSpellingService(
291 int identifier, 298 int identifier,
292 int offset, 299 int offset,
293 bool succeeded, 300 bool succeeded,
294 const string16& line, 301 const string16& line,
295 const std::vector<SpellCheckResult>& results) { 302 const std::vector<SpellCheckResult>& results) {
296 WebTextCheckingCompletion* completion = 303 WebTextCheckingCompletion* completion =
297 text_check_completions_.Lookup(identifier); 304 text_check_completions_.Lookup(identifier);
298 if (!completion) 305 if (!completion)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // TODO(darin): There's actually no reason for this to be here. We should 394 // TODO(darin): There's actually no reason for this to be here. We should
388 // have the browser side manage the document tag. 395 // have the browser side manage the document tag.
389 #if defined(OS_MACOSX) 396 #if defined(OS_MACOSX)
390 if (!has_document_tag_) { 397 if (!has_document_tag_) {
391 // Make the call to get the tag. 398 // Make the call to get the tag.
392 Send(new SpellCheckHostMsg_GetDocumentTag(routing_id(), &document_tag_)); 399 Send(new SpellCheckHostMsg_GetDocumentTag(routing_id(), &document_tag_));
393 has_document_tag_ = true; 400 has_document_tag_ = true;
394 } 401 }
395 #endif 402 #endif
396 } 403 }
OLDNEW
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698