| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file implements the interface defined in spellchecker_platform_engine.h | 5 // This file implements the interface defined in spellchecker_platform_engine.h |
| 6 // for the OS X platform. | 6 // for the OS X platform. |
| 7 | 7 |
| 8 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" | 8 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" |
| 9 | 9 |
| 10 #import <Cocoa/Cocoa.h> | 10 #import <Cocoa/Cocoa.h> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
| 15 #include "base/task.h" | 15 #include "base/task.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "chrome/common/spellcheck_common.h" | 17 #include "chrome/common/spellcheck_common.h" |
| 18 #include "chrome/common/spellcheck_messages.h" | 18 #include "chrome/common/spellcheck_messages.h" |
| 19 #include "content/browser/browser_message_filter.h" | 19 #include "content/browser/browser_message_filter.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult
.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult
.h" |
| 22 | 22 |
| 23 using base::TimeTicks; | 23 using base::TimeTicks; |
| 24 using content::BrowserThread; |
| 25 |
| 24 namespace { | 26 namespace { |
| 25 // The number of characters in the first part of the language code. | 27 // The number of characters in the first part of the language code. |
| 26 const unsigned int kShortLanguageCodeSize = 2; | 28 const unsigned int kShortLanguageCodeSize = 2; |
| 27 | 29 |
| 28 // TextCheckingTask is reserved for spell checking against large size | 30 // TextCheckingTask is reserved for spell checking against large size |
| 29 // of text, which possible contains multiple paragrpahs. Checking | 31 // of text, which possible contains multiple paragrpahs. Checking |
| 30 // that size of text might take time, and should be done as a task on | 32 // that size of text might take time, and should be done as a task on |
| 31 // the FILE thread. | 33 // the FILE thread. |
| 32 // | 34 // |
| 33 // The result of the check is returned back as a | 35 // The result of the check is returned back as a |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 int identifier, | 291 int identifier, |
| 290 int document_tag, | 292 int document_tag, |
| 291 const string16& text, BrowserMessageFilter* destination) { | 293 const string16& text, BrowserMessageFilter* destination) { |
| 292 BrowserThread::PostTask( | 294 BrowserThread::PostTask( |
| 293 BrowserThread::FILE, FROM_HERE, | 295 BrowserThread::FILE, FROM_HERE, |
| 294 new TextCheckingTask( | 296 new TextCheckingTask( |
| 295 destination, route_id, identifier, text, document_tag)); | 297 destination, route_id, identifier, text, document_tag)); |
| 296 } | 298 } |
| 297 | 299 |
| 298 } // namespace SpellCheckerPlatform | 300 } // namespace SpellCheckerPlatform |
| OLD | NEW |