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

Side by Side Diff: components/spellcheck/renderer/spellcheck_provider.cc

Issue 2251693003: Rename "ContinuousSpellChecking" to "SpellChecking" in Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/accessibility/misspellings.html » ('j') | 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 "components/spellcheck/renderer/spellcheck_provider.h" 5 #include "components/spellcheck/renderer/spellcheck_provider.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "components/spellcheck/common/spellcheck_marker.h" 9 #include "components/spellcheck/common/spellcheck_marker.h"
10 #include "components/spellcheck/common/spellcheck_messages.h" 10 #include "components/spellcheck/common/spellcheck_messages.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 IPC_END_MESSAGE_MAP() 108 IPC_END_MESSAGE_MAP()
109 return handled; 109 return handled;
110 } 110 }
111 111
112 void SpellCheckProvider::FocusedNodeChanged(const blink::WebNode& unused) { 112 void SpellCheckProvider::FocusedNodeChanged(const blink::WebNode& unused) {
113 #if defined(USE_BROWSER_SPELLCHECKER) 113 #if defined(USE_BROWSER_SPELLCHECKER)
114 WebLocalFrame* frame = render_view()->GetWebView()->focusedFrame(); 114 WebLocalFrame* frame = render_view()->GetWebView()->focusedFrame();
115 WebElement element = frame->document().isNull() ? WebElement() : 115 WebElement element = frame->document().isNull() ? WebElement() :
116 frame->document().focusedElement(); 116 frame->document().focusedElement();
117 bool enabled = !element.isNull() && element.isEditable(); 117 bool enabled = !element.isNull() && element.isEditable();
118 bool checked = enabled && frame->isContinuousSpellCheckingEnabled(); 118 bool checked = enabled && frame->isSpellCheckingEnabled();
119 119
120 Send(new SpellCheckHostMsg_ToggleSpellCheck(routing_id(), enabled, checked)); 120 Send(new SpellCheckHostMsg_ToggleSpellCheck(routing_id(), enabled, checked));
121 #endif // USE_BROWSER_SPELLCHECKER 121 #endif // USE_BROWSER_SPELLCHECKER
122 } 122 }
123 123
124 void SpellCheckProvider::spellCheck( 124 void SpellCheckProvider::spellCheck(
125 const WebString& text, 125 const WebString& text,
126 int& offset, 126 int& offset,
127 int& length, 127 int& length,
128 WebVector<WebString>* optional_suggestions) { 128 WebVector<WebString>* optional_suggestions) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 void SpellCheckProvider::EnableSpellcheck(bool enable) { 279 void SpellCheckProvider::EnableSpellcheck(bool enable) {
280 if (!render_view()->GetWebView()) 280 if (!render_view()->GetWebView())
281 return; 281 return;
282 282
283 WebLocalFrame* frame = render_view()->GetWebView()->focusedFrame(); 283 WebLocalFrame* frame = render_view()->GetWebView()->focusedFrame();
284 // TODO(yabinh): The null check should be unnecessary. 284 // TODO(yabinh): The null check should be unnecessary.
285 // See crbug.com/625068 285 // See crbug.com/625068
286 if (!frame) 286 if (!frame)
287 return; 287 return;
288 288
289 frame->enableContinuousSpellChecking(enable); 289 frame->enableSpellChecking(enable);
290 if (!enable) 290 if (!enable)
291 frame->removeSpellingMarkers(); 291 frame->removeSpellingMarkers();
292 } 292 }
293 293
294 bool SpellCheckProvider::SatisfyRequestFromCache( 294 bool SpellCheckProvider::SatisfyRequestFromCache(
295 const base::string16& text, 295 const base::string16& text,
296 WebTextCheckingCompletion* completion) { 296 WebTextCheckingCompletion* completion) {
297 size_t last_length = last_request_.length(); 297 size_t last_length = last_request_.length();
298 298
299 // Send back the |last_results_| if the |last_request_| is a substring of 299 // Send back the |last_results_| if the |last_request_| is a substring of
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 return true; 341 return true;
342 } 342 }
343 } 343 }
344 344
345 return false; 345 return false;
346 } 346 }
347 347
348 void SpellCheckProvider::OnDestruct() { 348 void SpellCheckProvider::OnDestruct() {
349 delete this; 349 delete this;
350 } 350 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/accessibility/misspellings.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698