OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return base::SysNSStringToUTF8([NSString stringWithFormat:@"%@-%@", | 66 return base::SysNSStringToUTF8([NSString stringWithFormat:@"%@-%@", |
67 [lang_code substringToIndex:kShortLanguageCodeSize], | 67 [lang_code substringToIndex:kShortLanguageCodeSize], |
68 [lang_code substringFromIndex:(kShortLanguageCodeSize + 1)]]); | 68 [lang_code substringFromIndex:(kShortLanguageCodeSize + 1)]]); |
69 } | 69 } |
70 return base::SysNSStringToUTF8(lang_code); | 70 return base::SysNSStringToUTF8(lang_code); |
71 } | 71 } |
72 | 72 |
73 } // namespace | 73 } // namespace |
74 | 74 |
75 namespace SpellCheckerPlatform { | 75 namespace SpellCheckerPlatform { |
| 76 |
76 void GetAvailableLanguages(std::vector<std::string>* spellcheck_languages) { | 77 void GetAvailableLanguages(std::vector<std::string>* spellcheck_languages) { |
77 NSArray* availableLanguages = [[NSSpellChecker sharedSpellChecker] | 78 NSArray* availableLanguages = [[NSSpellChecker sharedSpellChecker] |
78 availableLanguages]; | 79 availableLanguages]; |
79 for (NSString* lang_code in availableLanguages) { | 80 for (NSString* lang_code in availableLanguages) { |
80 spellcheck_languages->push_back( | 81 spellcheck_languages->push_back( |
81 ConvertLanguageCodeFromMac(lang_code)); | 82 ConvertLanguageCodeFromMac(lang_code)); |
82 } | 83 } |
83 } | 84 } |
84 | 85 |
85 bool SpellCheckerAvailable() { | 86 bool SpellCheckerAvailable() { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 [[NSSpellChecker sharedSpellChecker] ignoreWord:base::SysUTF16ToNSString(word) | 201 [[NSSpellChecker sharedSpellChecker] ignoreWord:base::SysUTF16ToNSString(word) |
201 inSpellDocumentWithTag:last_seen_tag_]; | 202 inSpellDocumentWithTag:last_seen_tag_]; |
202 } | 203 } |
203 | 204 |
204 void CloseDocumentWithTag(int tag) { | 205 void CloseDocumentWithTag(int tag) { |
205 [[NSSpellChecker sharedSpellChecker] | 206 [[NSSpellChecker sharedSpellChecker] |
206 closeSpellDocumentWithTag:static_cast<NSInteger>(tag)]; | 207 closeSpellDocumentWithTag:static_cast<NSInteger>(tag)]; |
207 } | 208 } |
208 | 209 |
209 } // namespace SpellCheckerPlatform | 210 } // namespace SpellCheckerPlatform |
210 | |
OLD | NEW |