Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: chrome/renderer/spellchecker/spellcheck_provider.cc

Issue 1548153002: Switch to standard integer types in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 // TODO(groby): As far as I can tell, this method is never invoked. 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. 158 // UMA results seem to support that. Investigate, clean up if true.
159 NOTREACHED(); 159 NOTREACHED();
160 spellcheck_->SpellCheckParagraph(text, results); 160 spellcheck_->SpellCheckParagraph(text, results);
161 UMA_HISTOGRAM_COUNTS("SpellCheck.api.paragraph", text.length()); 161 UMA_HISTOGRAM_COUNTS("SpellCheck.api.paragraph", text.length());
162 } 162 }
163 163
164 void SpellCheckProvider::requestCheckingOfText( 164 void SpellCheckProvider::requestCheckingOfText(
165 const WebString& text, 165 const WebString& text,
166 const WebVector<uint32>& markers, 166 const WebVector<uint32_t>& markers,
167 const WebVector<unsigned>& marker_offsets, 167 const WebVector<unsigned>& marker_offsets,
168 WebTextCheckingCompletion* completion) { 168 WebTextCheckingCompletion* completion) {
169 std::vector<SpellCheckMarker> spellcheck_markers; 169 std::vector<SpellCheckMarker> spellcheck_markers;
170 for (size_t i = 0; i < markers.size(); ++i) { 170 for (size_t i = 0; i < markers.size(); ++i) {
171 spellcheck_markers.push_back( 171 spellcheck_markers.push_back(
172 SpellCheckMarker(markers[i], marker_offsets[i])); 172 SpellCheckMarker(markers[i], marker_offsets[i]));
173 } 173 }
174 RequestTextChecking(text, completion, spellcheck_markers); 174 RequestTextChecking(text, completion, spellcheck_markers);
175 UMA_HISTOGRAM_COUNTS("SpellCheck.api.async", text.length()); 175 UMA_HISTOGRAM_COUNTS("SpellCheck.api.async", text.length());
176 } 176 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 last_results_.swap(textcheck_results); 227 last_results_.swap(textcheck_results);
228 } 228 }
229 #endif 229 #endif
230 230
231 bool SpellCheckProvider::HasWordCharacters( 231 bool SpellCheckProvider::HasWordCharacters(
232 const base::string16& text, 232 const base::string16& text,
233 int index) const { 233 int index) const {
234 const base::char16* data = text.data(); 234 const base::char16* data = text.data();
235 int length = text.length(); 235 int length = text.length();
236 while (index < length) { 236 while (index < length) {
237 uint32 code = 0; 237 uint32_t code = 0;
238 U16_NEXT(data, index, length, code); 238 U16_NEXT(data, index, length, code);
239 UErrorCode error = U_ZERO_ERROR; 239 UErrorCode error = U_ZERO_ERROR;
240 if (uscript_getScript(code, &error) != USCRIPT_COMMON) 240 if (uscript_getScript(code, &error) != USCRIPT_COMMON)
241 return true; 241 return true;
242 } 242 }
243 return false; 243 return false;
244 } 244 }
245 245
246 #if defined(USE_BROWSER_SPELLCHECKER) 246 #if defined(USE_BROWSER_SPELLCHECKER)
247 void SpellCheckProvider::OnAdvanceToNextMisspelling() { 247 void SpellCheckProvider::OnAdvanceToNextMisspelling() {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 results[i].length = last_results_[i].length; 342 results[i].length = last_results_[i].length;
343 results[i].replacement = last_results_[i].replacement; 343 results[i].replacement = last_results_[i].replacement;
344 } 344 }
345 completion->didFinishCheckingText(results); 345 completion->didFinishCheckingText(results);
346 return true; 346 return true;
347 } 347 }
348 } 348 }
349 349
350 return false; 350 return false;
351 } 351 }
OLDNEW
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck_provider.h ('k') | chrome/renderer/spellchecker/spellcheck_provider_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698