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

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

Issue 10155006: Cancel unnecessary spellcheck requests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 text_check_completions_.Add(completion), 81 text_check_completions_.Add(completion),
82 document_tag, 82 document_tag,
83 text)); 83 text));
84 #else 84 #else
85 // Send this text to a browser. A browser checks the user profile and send 85 // Send this text to a browser. A browser checks the user profile and send
86 // this text to the Spelling service only if a user enables this feature. 86 // this text to the Spelling service only if a user enables this feature.
87 // TODO(hbono) Implement a cache to avoid sending IPC messages. 87 // TODO(hbono) Implement a cache to avoid sending IPC messages.
88 string16 line; 88 string16 line;
89 int offset = -1; 89 int offset = -1;
90 if (!GetRequestLine(text, &line, &offset)) { 90 if (!GetRequestLine(text, &line, &offset)) {
91 completion->didFinishCheckingText(std::vector<WebTextCheckingResult>()); 91 completion->didCancelCheckingText();
92 return; 92 return;
93 } 93 }
94 94
95 last_line_ = line; 95 last_line_ = line;
96 Send(new SpellCheckHostMsg_CallSpellingService( 96 Send(new SpellCheckHostMsg_CallSpellingService(
97 routing_id(), 97 routing_id(),
98 text_check_completions_.Add(completion), 98 text_check_completions_.Add(completion),
99 offset, 99 offset,
100 line)); 100 line));
101 #endif // !OS_MACOSX 101 #endif // !OS_MACOSX
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // TODO(darin): There's actually no reason for this to be here. We should 349 // TODO(darin): There's actually no reason for this to be here. We should
350 // have the browser side manage the document tag. 350 // have the browser side manage the document tag.
351 #if defined(OS_MACOSX) 351 #if defined(OS_MACOSX)
352 if (!has_document_tag_) { 352 if (!has_document_tag_) {
353 // Make the call to get the tag. 353 // Make the call to get the tag.
354 Send(new SpellCheckHostMsg_GetDocumentTag(routing_id(), &document_tag_)); 354 Send(new SpellCheckHostMsg_GetDocumentTag(routing_id(), &document_tag_));
355 has_document_tag_ = true; 355 has_document_tag_ = true;
356 } 356 }
357 #endif 357 #endif
358 } 358 }
OLDNEW
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck.cc ('k') | chrome/renderer/spellchecker/spellcheck_provider_hunspell_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698