| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 // Cache the request and the converted results. | 235 // Cache the request and the converted results. |
| 236 last_request_ = line; | 236 last_request_ = line; |
| 237 last_results_.swap(textcheck_results); | 237 last_results_.swap(textcheck_results); |
| 238 } | 238 } |
| 239 #endif | 239 #endif |
| 240 | 240 |
| 241 bool SpellCheckProvider::HasWordCharacters( | 241 bool SpellCheckProvider::HasWordCharacters( |
| 242 const base::string16& text, | 242 const base::string16& text, |
| 243 int index) const { | 243 int index) const { |
| 244 const char16* data = text.data(); | 244 const base::char16* data = text.data(); |
| 245 int length = text.length(); | 245 int length = text.length(); |
| 246 while (index < length) { | 246 while (index < length) { |
| 247 uint32 code = 0; | 247 uint32 code = 0; |
| 248 U16_NEXT(data, index, length, code); | 248 U16_NEXT(data, index, length, code); |
| 249 UErrorCode error = U_ZERO_ERROR; | 249 UErrorCode error = U_ZERO_ERROR; |
| 250 if (uscript_getScript(code, &error) != USCRIPT_COMMON) | 250 if (uscript_getScript(code, &error) != USCRIPT_COMMON) |
| 251 return true; | 251 return true; |
| 252 } | 252 } |
| 253 return false; | 253 return false; |
| 254 } | 254 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 results[i].length = last_results_[i].length; | 351 results[i].length = last_results_[i].length; |
| 352 results[i].replacement = last_results_[i].replacement; | 352 results[i].replacement = last_results_[i].replacement; |
| 353 } | 353 } |
| 354 completion->didFinishCheckingText(results); | 354 completion->didFinishCheckingText(results); |
| 355 return true; | 355 return true; |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 | 358 |
| 359 return false; | 359 return false; |
| 360 } | 360 } |
| OLD | NEW |