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 "components/spellcheck/renderer/spellcheck_provider.h" | 5 #include "components/spellcheck/renderer/spellcheck_provider.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "components/spellcheck/common/spellcheck_messages.h" | 8 #include "components/spellcheck/common/spellcheck_messages.h" |
9 #include "components/spellcheck/common/spellcheck_result.h" | 9 #include "components/spellcheck/common/spellcheck_result.h" |
10 #include "components/spellcheck/renderer/spellcheck.h" | 10 #include "components/spellcheck/renderer/spellcheck.h" |
11 #include "components/spellcheck/renderer/spellcheck_language.h" | 11 #include "components/spellcheck/renderer/spellcheck_language.h" |
12 #include "components/spellcheck/spellcheck_build_features.h" | 12 #include "components/spellcheck/spellcheck_build_features.h" |
| 13 #include "content/public/renderer/render_frame.h" |
13 #include "content/public/renderer/render_view.h" | 14 #include "content/public/renderer/render_view.h" |
14 #include "third_party/WebKit/public/platform/WebVector.h" | 15 #include "third_party/WebKit/public/platform/WebVector.h" |
15 #include "third_party/WebKit/public/web/WebDocument.h" | 16 #include "third_party/WebKit/public/web/WebDocument.h" |
16 #include "third_party/WebKit/public/web/WebElement.h" | 17 #include "third_party/WebKit/public/web/WebElement.h" |
17 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 18 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
18 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" | 19 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" |
19 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" | 20 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" |
20 #include "third_party/WebKit/public/web/WebTextDecorationType.h" | 21 #include "third_party/WebKit/public/web/WebTextDecorationType.h" |
21 #include "third_party/WebKit/public/web/WebView.h" | 22 #include "third_party/WebKit/public/web/WebView.h" |
22 | 23 |
(...skipping 11 matching lines...) Expand all Loading... |
34 int(SpellCheckResult::GRAMMAR), "mismatching enums"); | 35 int(SpellCheckResult::GRAMMAR), "mismatching enums"); |
35 | 36 |
36 SpellCheckProvider::SpellCheckProvider( | 37 SpellCheckProvider::SpellCheckProvider( |
37 content::RenderView* render_view, | 38 content::RenderView* render_view, |
38 SpellCheck* spellcheck) | 39 SpellCheck* spellcheck) |
39 : content::RenderViewObserver(render_view), | 40 : content::RenderViewObserver(render_view), |
40 content::RenderViewObserverTracker<SpellCheckProvider>(render_view), | 41 content::RenderViewObserverTracker<SpellCheckProvider>(render_view), |
41 spellcheck_(spellcheck) { | 42 spellcheck_(spellcheck) { |
42 DCHECK(spellcheck_); | 43 DCHECK(spellcheck_); |
43 if (render_view) { // NULL in unit tests. | 44 if (render_view) { // NULL in unit tests. |
44 render_view->GetWebView()->setTextCheckClient(this); | |
45 EnableSpellcheck(spellcheck_->IsSpellcheckEnabled()); | 45 EnableSpellcheck(spellcheck_->IsSpellcheckEnabled()); |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 SpellCheckProvider::~SpellCheckProvider() { | 49 SpellCheckProvider::~SpellCheckProvider() { |
50 } | 50 } |
51 | 51 |
52 void SpellCheckProvider::RequestTextChecking( | 52 void SpellCheckProvider::RequestTextChecking( |
53 const base::string16& text, | 53 const base::string16& text, |
54 WebTextCheckingCompletion* completion) { | 54 WebTextCheckingCompletion* completion) { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 completion->didFinishCheckingText(results); | 277 completion->didFinishCheckingText(results); |
278 return true; | 278 return true; |
279 } | 279 } |
280 | 280 |
281 return false; | 281 return false; |
282 } | 282 } |
283 | 283 |
284 void SpellCheckProvider::OnDestruct() { | 284 void SpellCheckProvider::OnDestruct() { |
285 delete this; | 285 delete this; |
286 } | 286 } |
OLD | NEW |