OLD | NEW |
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 "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/spellcheck_marker.h" | 10 #include "chrome/common/spellcheck_marker.h" |
11 #include "chrome/common/spellcheck_messages.h" | 11 #include "chrome/common/spellcheck_messages.h" |
12 #include "chrome/common/spellcheck_result.h" | 12 #include "chrome/common/spellcheck_result.h" |
13 #include "chrome/renderer/spellchecker/spellcheck.h" | 13 #include "chrome/renderer/spellchecker/spellcheck.h" |
14 #include "content/public/renderer/render_view.h" | 14 #include "content/public/renderer/render_view.h" |
15 #include "third_party/WebKit/public/platform/WebVector.h" | 15 #include "third_party/WebKit/public/platform/WebVector.h" |
| 16 #include "third_party/WebKit/public/web/WebElement.h" |
16 #include "third_party/WebKit/public/web/WebFrame.h" | 17 #include "third_party/WebKit/public/web/WebFrame.h" |
17 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" | 18 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" |
18 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" | 19 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" |
19 #include "third_party/WebKit/public/web/WebTextDecorationType.h" | 20 #include "third_party/WebKit/public/web/WebTextDecorationType.h" |
20 #include "third_party/WebKit/public/web/WebView.h" | 21 #include "third_party/WebKit/public/web/WebView.h" |
21 | 22 |
22 using blink::WebFrame; | 23 using blink::WebFrame; |
23 using blink::WebString; | 24 using blink::WebString; |
24 using blink::WebTextCheckingCompletion; | 25 using blink::WebTextCheckingCompletion; |
25 using blink::WebTextCheckingResult; | 26 using blink::WebTextCheckingResult; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 IPC_MESSAGE_HANDLER(SpellCheckMsg_ToggleSpellPanel, OnToggleSpellPanel) | 103 IPC_MESSAGE_HANDLER(SpellCheckMsg_ToggleSpellPanel, OnToggleSpellPanel) |
103 #endif | 104 #endif |
104 IPC_MESSAGE_UNHANDLED(handled = false) | 105 IPC_MESSAGE_UNHANDLED(handled = false) |
105 IPC_END_MESSAGE_MAP() | 106 IPC_END_MESSAGE_MAP() |
106 return handled; | 107 return handled; |
107 } | 108 } |
108 | 109 |
109 void SpellCheckProvider::FocusedNodeChanged(const blink::WebNode& unused) { | 110 void SpellCheckProvider::FocusedNodeChanged(const blink::WebNode& unused) { |
110 #if defined(OS_MACOSX) | 111 #if defined(OS_MACOSX) |
111 bool enabled = false; | 112 bool enabled = false; |
112 blink::WebNode node = render_view()->GetFocusedNode(); | 113 blink::WebElement element = render_view()->GetFocusedElement(); |
113 if (!node.isNull()) | 114 if (!element.isNull()) |
114 enabled = render_view()->IsEditableNode(node); | 115 enabled = render_view()->IsEditableNode(element); |
115 | 116 |
116 bool checked = false; | 117 bool checked = false; |
117 if (enabled && render_view()->GetWebView()) { | 118 if (enabled && render_view()->GetWebView()) { |
118 WebFrame* frame = render_view()->GetWebView()->focusedFrame(); | 119 WebFrame* frame = render_view()->GetWebView()->focusedFrame(); |
119 if (frame->isContinuousSpellCheckingEnabled()) | 120 if (frame->isContinuousSpellCheckingEnabled()) |
120 checked = true; | 121 checked = true; |
121 } | 122 } |
122 | 123 |
123 Send(new SpellCheckHostMsg_ToggleSpellCheck(routing_id(), enabled, checked)); | 124 Send(new SpellCheckHostMsg_ToggleSpellCheck(routing_id(), enabled, checked)); |
124 #endif // OS_MACOSX | 125 #endif // OS_MACOSX |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 results[i].length = last_results_[i].length; | 352 results[i].length = last_results_[i].length; |
352 results[i].replacement = last_results_[i].replacement; | 353 results[i].replacement = last_results_[i].replacement; |
353 } | 354 } |
354 completion->didFinishCheckingText(results); | 355 completion->didFinishCheckingText(results); |
355 return true; | 356 return true; |
356 } | 357 } |
357 } | 358 } |
358 | 359 |
359 return false; | 360 return false; |
360 } | 361 } |
OLD | NEW |