| 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 // Integration with OS X native spellchecker. | 5 // Integration with OS X native spellchecker. |
| 6 | 6 |
| 7 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" | 7 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 | 10 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 void FillSuggestionList(const string16& wrong_word, | 235 void FillSuggestionList(const string16& wrong_word, |
| 236 std::vector<string16>* optional_suggestions) { | 236 std::vector<string16>* optional_suggestions) { |
| 237 NSString* NS_wrong_word = base::SysUTF16ToNSString(wrong_word); | 237 NSString* NS_wrong_word = base::SysUTF16ToNSString(wrong_word); |
| 238 TimeTicks debug_begin_time = base::Histogram::DebugNow(); | 238 TimeTicks debug_begin_time = base::Histogram::DebugNow(); |
| 239 // The suggested words for |wrong_word|. | 239 // The suggested words for |wrong_word|. |
| 240 NSArray* guesses = [SharedSpellChecker() guessesForWord:NS_wrong_word]; | 240 NSArray* guesses = [SharedSpellChecker() guessesForWord:NS_wrong_word]; |
| 241 DHISTOGRAM_TIMES("Spellcheck.SuggestTime", | 241 DHISTOGRAM_TIMES("Spellcheck.SuggestTime", |
| 242 base::Histogram::DebugNow() - debug_begin_time); | 242 base::Histogram::DebugNow() - debug_begin_time); |
| 243 | 243 |
| 244 for (int i = 0; i < static_cast<int>([guesses count]); i++) { | 244 for (int i = 0; i < static_cast<int>([guesses count]); ++i) { |
| 245 if (i < SpellCheckCommon::kMaxSuggestions) { | 245 if (i < chrome::spellcheck_common::kMaxSuggestions) { |
| 246 optional_suggestions->push_back(base::SysNSStringToUTF16( | 246 optional_suggestions->push_back(base::SysNSStringToUTF16( |
| 247 [guesses objectAtIndex:i])); | 247 [guesses objectAtIndex:i])); |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 void AddWord(const string16& word) { | 252 void AddWord(const string16& word) { |
| 253 NSString* word_to_add = base::SysUTF16ToNSString(word); | 253 NSString* word_to_add = base::SysUTF16ToNSString(word); |
| 254 [SharedSpellChecker() learnWord:word_to_add]; | 254 [SharedSpellChecker() learnWord:word_to_add]; |
| 255 } | 255 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 277 int identifier, | 277 int identifier, |
| 278 int document_tag, | 278 int document_tag, |
| 279 const string16& text, BrowserMessageFilter* destination) { | 279 const string16& text, BrowserMessageFilter* destination) { |
| 280 BrowserThread::PostTask( | 280 BrowserThread::PostTask( |
| 281 BrowserThread::FILE, FROM_HERE, | 281 BrowserThread::FILE, FROM_HERE, |
| 282 base::Bind(&TextCheckingCallback, make_scoped_refptr(destination), | 282 base::Bind(&TextCheckingCallback, make_scoped_refptr(destination), |
| 283 route_id, identifier, text, document_tag)); | 283 route_id, identifier, text, document_tag)); |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace spellcheck_mac | 286 } // namespace spellcheck_mac |
| OLD | NEW |