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

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

Issue 10572007: Revert 142671 - Use WebFrame::replaceMisspelledRange() to replace a misspelled range with text. (Closed) Base URL: svn://svn.chromium.org/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)
170 #if !defined(OS_MACOSX) 169 #if !defined(OS_MACOSX)
171 IPC_MESSAGE_HANDLER(SpellCheckMsg_RespondSpellingService, 170 IPC_MESSAGE_HANDLER(SpellCheckMsg_RespondSpellingService,
172 OnRespondSpellingService) 171 OnRespondSpellingService)
173 #endif 172 #endif
174 #if defined(OS_MACOSX) 173 #if defined(OS_MACOSX)
175 IPC_MESSAGE_HANDLER(SpellCheckMsg_AdvanceToNextMisspelling, 174 IPC_MESSAGE_HANDLER(SpellCheckMsg_AdvanceToNextMisspelling,
176 OnAdvanceToNextMisspelling) 175 OnAdvanceToNextMisspelling)
177 IPC_MESSAGE_HANDLER(SpellCheckMsg_RespondTextCheck, OnRespondTextCheck) 176 IPC_MESSAGE_HANDLER(SpellCheckMsg_RespondTextCheck, OnRespondTextCheck)
178 IPC_MESSAGE_HANDLER(SpellCheckMsg_ToggleSpellPanel, OnToggleSpellPanel) 177 IPC_MESSAGE_HANDLER(SpellCheckMsg_ToggleSpellPanel, OnToggleSpellPanel)
179 #endif 178 #endif
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 279 }
281 280
282 void SpellCheckProvider::updateSpellingUIWithMisspelledWord( 281 void SpellCheckProvider::updateSpellingUIWithMisspelledWord(
283 const WebString& word) { 282 const WebString& word) {
284 #if defined(OS_MACOSX) 283 #if defined(OS_MACOSX)
285 Send(new SpellCheckHostMsg_UpdateSpellingPanelWithMisspelledWord(routing_id(), 284 Send(new SpellCheckHostMsg_UpdateSpellingPanelWithMisspelledWord(routing_id(),
286 word)); 285 word));
287 #endif 286 #endif
288 } 287 }
289 288
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
296 #if !defined(OS_MACOSX) 289 #if !defined(OS_MACOSX)
297 void SpellCheckProvider::OnRespondSpellingService( 290 void SpellCheckProvider::OnRespondSpellingService(
298 int identifier, 291 int identifier,
299 int offset, 292 int offset,
300 bool succeeded, 293 bool succeeded,
301 const string16& line, 294 const string16& line,
302 const std::vector<SpellCheckResult>& results) { 295 const std::vector<SpellCheckResult>& results) {
303 WebTextCheckingCompletion* completion = 296 WebTextCheckingCompletion* completion =
304 text_check_completions_.Lookup(identifier); 297 text_check_completions_.Lookup(identifier);
305 if (!completion) 298 if (!completion)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // TODO(darin): There's actually no reason for this to be here. We should 387 // TODO(darin): There's actually no reason for this to be here. We should
395 // have the browser side manage the document tag. 388 // have the browser side manage the document tag.
396 #if defined(OS_MACOSX) 389 #if defined(OS_MACOSX)
397 if (!has_document_tag_) { 390 if (!has_document_tag_) {
398 // Make the call to get the tag. 391 // Make the call to get the tag.
399 Send(new SpellCheckHostMsg_GetDocumentTag(routing_id(), &document_tag_)); 392 Send(new SpellCheckHostMsg_GetDocumentTag(routing_id(), &document_tag_));
400 has_document_tag_ = true; 393 has_document_tag_ = true;
401 } 394 }
402 #endif 395 #endif
403 } 396 }
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