| 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 // 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 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/mac/foundation_util.h" | 12 #include "base/mac/foundation_util.h" |
| 13 #include "base/mac/scoped_nsexception_enabler.h" | 13 #include "base/mac/scoped_nsexception_enabler.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
| 16 #include "base/task.h" | 16 #include "base/task.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "chrome/common/spellcheck_common.h" | 18 #include "chrome/common/spellcheck_common.h" |
| 19 #include "chrome/common/spellcheck_messages.h" | 19 #include "chrome/common/spellcheck_messages.h" |
| 20 #include "content/browser/browser_message_filter.h" | 20 #include "content/public/browser/browser_message_filter.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult
.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult
.h" |
| 23 | 23 |
| 24 using base::TimeTicks; | 24 using base::TimeTicks; |
| 25 using content::BrowserMessageFilter; |
| 25 using content::BrowserThread; | 26 using content::BrowserThread; |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 // The number of characters in the first part of the language code. | 29 // The number of characters in the first part of the language code. |
| 29 const unsigned int kShortLanguageCodeSize = 2; | 30 const unsigned int kShortLanguageCodeSize = 2; |
| 30 | 31 |
| 31 // +[NSSpellChecker sharedSpellChecker] can throw exceptions depending | 32 // +[NSSpellChecker sharedSpellChecker] can throw exceptions depending |
| 32 // on the state of the pasteboard, or possibly as a result of | 33 // on the state of the pasteboard, or possibly as a result of |
| 33 // third-party code (when setting up services entries). The following | 34 // third-party code (when setting up services entries). The following |
| 34 // receives nil if an exception is thrown, in which case | 35 // receives nil if an exception is thrown, in which case |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 int identifier, | 298 int identifier, |
| 298 int document_tag, | 299 int document_tag, |
| 299 const string16& text, BrowserMessageFilter* destination) { | 300 const string16& text, BrowserMessageFilter* destination) { |
| 300 BrowserThread::PostTask( | 301 BrowserThread::PostTask( |
| 301 BrowserThread::FILE, FROM_HERE, | 302 BrowserThread::FILE, FROM_HERE, |
| 302 new TextCheckingTask( | 303 new TextCheckingTask( |
| 303 destination, route_id, identifier, text, document_tag)); | 304 destination, route_id, identifier, text, document_tag)); |
| 304 } | 305 } |
| 305 | 306 |
| 306 } // namespace spellcheck_mac | 307 } // namespace spellcheck_mac |
| OLD | NEW |