| 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" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 SpellCheckProvider::SpellCheckProvider( | 40 SpellCheckProvider::SpellCheckProvider( |
| 41 content::RenderView* render_view, | 41 content::RenderView* render_view, |
| 42 SpellCheck* spellcheck) | 42 SpellCheck* spellcheck) |
| 43 : content::RenderViewObserver(render_view), | 43 : content::RenderViewObserver(render_view), |
| 44 content::RenderViewObserverTracker<SpellCheckProvider>(render_view), | 44 content::RenderViewObserverTracker<SpellCheckProvider>(render_view), |
| 45 spelling_panel_visible_(false), | 45 spelling_panel_visible_(false), |
| 46 spellcheck_(spellcheck) { | 46 spellcheck_(spellcheck) { |
| 47 DCHECK(spellcheck_); | 47 DCHECK(spellcheck_); |
| 48 if (render_view) { // NULL in unit tests. | 48 if (render_view) { // NULL in unit tests. |
| 49 render_view->GetWebView()->setSpellCheckClient(this); | 49 render_view->GetWebView()->setSpellCheckClient(this); |
| 50 EnableSpellcheck(spellcheck_->is_spellcheck_enabled()); | 50 EnableSpellcheck(spellcheck_->IsSpellcheckEnabled()); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 SpellCheckProvider::~SpellCheckProvider() { | 54 SpellCheckProvider::~SpellCheckProvider() { |
| 55 } | 55 } |
| 56 | 56 |
| 57 void SpellCheckProvider::RequestTextChecking( | 57 void SpellCheckProvider::RequestTextChecking( |
| 58 const base::string16& text, | 58 const base::string16& text, |
| 59 WebTextCheckingCompletion* completion, | 59 WebTextCheckingCompletion* completion, |
| 60 const std::vector<SpellCheckMarker>& markers) { | 60 const std::vector<SpellCheckMarker>& markers) { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 results[i].length = last_results_[i].length; | 353 results[i].length = last_results_[i].length; |
| 354 results[i].replacement = last_results_[i].replacement; | 354 results[i].replacement = last_results_[i].replacement; |
| 355 } | 355 } |
| 356 completion->didFinishCheckingText(results); | 356 completion->didFinishCheckingText(results); |
| 357 return true; | 357 return true; |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 | 360 |
| 361 return false; | 361 return false; |
| 362 } | 362 } |
| OLD | NEW |