| 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/WebElement.h" |
| 17 #include "third_party/WebKit/public/web/WebFrame.h" | 17 #include "third_party/WebKit/public/web/WebFrame.h" |
| 18 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" | 18 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" |
| 19 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" | 19 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" |
| 20 #include "third_party/WebKit/public/web/WebTextDecorationType.h" | 20 #include "third_party/WebKit/public/web/WebTextDecorationType.h" |
| 21 #include "third_party/WebKit/public/web/WebView.h" | 21 #include "third_party/WebKit/public/web/WebView.h" |
| 22 | 22 |
| 23 using blink::WebFrame; | 23 using blink::WebFrame; |
| 24 using blink::WebString; | 24 using blink::WebString; |
| 25 using blink::WebTextCheckingCompletion; | 25 using blink::WebTextCheckingCompletion; |
| 26 using blink::WebTextCheckingResult; | 26 using blink::WebTextCheckingResult; |
| 27 using blink::WebTextDecorationType; | 27 using blink::WebTextDecorationType; |
| 28 using blink::WebVector; | 28 using blink::WebVector; |
| 29 | 29 |
| 30 COMPILE_ASSERT(int(blink::WebTextDecorationTypeSpelling) == | 30 static_assert(int(blink::WebTextDecorationTypeSpelling) == |
| 31 int(SpellCheckResult::SPELLING), mismatching_enums); | 31 int(SpellCheckResult::SPELLING), "mismatching enums"); |
| 32 COMPILE_ASSERT(int(blink::WebTextDecorationTypeGrammar) == | 32 static_assert(int(blink::WebTextDecorationTypeGrammar) == |
| 33 int(SpellCheckResult::GRAMMAR), mismatching_enums); | 33 int(SpellCheckResult::GRAMMAR), "mismatching enums"); |
| 34 COMPILE_ASSERT(int(blink::WebTextDecorationTypeInvisibleSpellcheck) == | 34 static_assert(int(blink::WebTextDecorationTypeInvisibleSpellcheck) == |
| 35 int(SpellCheckResult::INVISIBLE), mismatching_enums); | 35 int(SpellCheckResult::INVISIBLE), "mismatching enums"); |
| 36 | 36 |
| 37 SpellCheckProvider::SpellCheckProvider( | 37 SpellCheckProvider::SpellCheckProvider( |
| 38 content::RenderView* render_view, | 38 content::RenderView* render_view, |
| 39 SpellCheck* spellcheck) | 39 SpellCheck* spellcheck) |
| 40 : content::RenderViewObserver(render_view), | 40 : content::RenderViewObserver(render_view), |
| 41 content::RenderViewObserverTracker<SpellCheckProvider>(render_view), | 41 content::RenderViewObserverTracker<SpellCheckProvider>(render_view), |
| 42 spelling_panel_visible_(false), | 42 spelling_panel_visible_(false), |
| 43 spellcheck_(spellcheck) { | 43 spellcheck_(spellcheck) { |
| 44 DCHECK(spellcheck_); | 44 DCHECK(spellcheck_); |
| 45 if (render_view) { // NULL in unit tests. | 45 if (render_view) { // NULL in unit tests. |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 results[i].length = last_results_[i].length; | 352 results[i].length = last_results_[i].length; |
| 353 results[i].replacement = last_results_[i].replacement; | 353 results[i].replacement = last_results_[i].replacement; |
| 354 } | 354 } |
| 355 completion->didFinishCheckingText(results); | 355 completion->didFinishCheckingText(results); |
| 356 return true; | 356 return true; |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 | 359 |
| 360 return false; | 360 return false; |
| 361 } | 361 } |
| OLD | NEW |