| 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/renderer/spellchecker/spellcheck.h" | 10 #include "chrome/renderer/spellchecker/spellcheck.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 *optional_suggestions = suggestions; | 137 *optional_suggestions = suggestions; |
| 138 UMA_HISTOGRAM_COUNTS("SpellCheck.api.check.suggestions", word.size()); | 138 UMA_HISTOGRAM_COUNTS("SpellCheck.api.check.suggestions", word.size()); |
| 139 } else { | 139 } else { |
| 140 UMA_HISTOGRAM_COUNTS("SpellCheck.api.check", word.size()); | 140 UMA_HISTOGRAM_COUNTS("SpellCheck.api.check", word.size()); |
| 141 // If optional_suggestions is not requested, the API is called | 141 // If optional_suggestions is not requested, the API is called |
| 142 // for marking. So we use this for counting markable words. | 142 // for marking. So we use this for counting markable words. |
| 143 Send(new SpellCheckHostMsg_NotifyChecked(routing_id(), word, 0 < length)); | 143 Send(new SpellCheckHostMsg_NotifyChecked(routing_id(), word, 0 < length)); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 void SpellCheckProvider::checkTextOfParagraph( | |
| 148 const blink::WebString& text, | |
| 149 blink::WebTextCheckingTypeMask mask, | |
| 150 blink::WebVector<blink::WebTextCheckingResult>* results) { | |
| 151 if (!results) | |
| 152 return; | |
| 153 | |
| 154 if (!(mask & blink::WebTextCheckingTypeSpelling)) | |
| 155 return; | |
| 156 | |
| 157 // TODO(groby): As far as I can tell, this method is never invoked. | |
| 158 // UMA results seem to support that. Investigate, clean up if true. | |
| 159 NOTREACHED(); | |
| 160 spellcheck_->SpellCheckParagraph(text, results); | |
| 161 UMA_HISTOGRAM_COUNTS("SpellCheck.api.paragraph", text.length()); | |
| 162 } | |
| 163 | |
| 164 void SpellCheckProvider::requestCheckingOfText( | 147 void SpellCheckProvider::requestCheckingOfText( |
| 165 const WebString& text, | 148 const WebString& text, |
| 166 const WebVector<uint32_t>& markers, | 149 const WebVector<uint32_t>& markers, |
| 167 const WebVector<unsigned>& marker_offsets, | 150 const WebVector<unsigned>& marker_offsets, |
| 168 WebTextCheckingCompletion* completion) { | 151 WebTextCheckingCompletion* completion) { |
| 169 std::vector<SpellCheckMarker> spellcheck_markers; | 152 std::vector<SpellCheckMarker> spellcheck_markers; |
| 170 for (size_t i = 0; i < markers.size(); ++i) { | 153 for (size_t i = 0; i < markers.size(); ++i) { |
| 171 spellcheck_markers.push_back( | 154 spellcheck_markers.push_back( |
| 172 SpellCheckMarker(markers[i], marker_offsets[i])); | 155 SpellCheckMarker(markers[i], marker_offsets[i])); |
| 173 } | 156 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 return true; | 334 return true; |
| 352 } | 335 } |
| 353 } | 336 } |
| 354 | 337 |
| 355 return false; | 338 return false; |
| 356 } | 339 } |
| 357 | 340 |
| 358 void SpellCheckProvider::OnDestruct() { | 341 void SpellCheckProvider::OnDestruct() { |
| 359 delete this; | 342 delete this; |
| 360 } | 343 } |
| OLD | NEW |