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 built-in spellchecker. | 5 // Integration with OS X built-in spellchecker. |
6 | 6 |
7 #include "chrome/browser/spellchecker/spellcheck_platform.h" | 7 #include "chrome/browser/spellchecker/spellcheck_platform.h" |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 namespace spellcheck_platform { | 102 namespace spellcheck_platform { |
103 | 103 |
104 void GetAvailableLanguages(std::vector<std::string>* spellcheck_languages) { | 104 void GetAvailableLanguages(std::vector<std::string>* spellcheck_languages) { |
105 NSArray* availableLanguages = [SharedSpellChecker() availableLanguages]; | 105 NSArray* availableLanguages = [SharedSpellChecker() availableLanguages]; |
106 for (NSString* lang_code in availableLanguages) { | 106 for (NSString* lang_code in availableLanguages) { |
107 spellcheck_languages->push_back( | 107 spellcheck_languages->push_back( |
108 ConvertLanguageCodeFromMac(lang_code)); | 108 ConvertLanguageCodeFromMac(lang_code)); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
| 112 std::string GetSpellCheckerLanguage() { |
| 113 return ConvertLanguageCodeFromMac([SharedSpellChecker() language]); |
| 114 } |
| 115 |
112 bool SpellCheckerAvailable() { | 116 bool SpellCheckerAvailable() { |
113 // If this file was compiled, then we know that we are on OS X 10.5 at least | 117 // If this file was compiled, then we know that we are on OS X 10.5 at least |
114 // and can safely return true here. | 118 // and can safely return true here. |
115 return true; | 119 return true; |
116 } | 120 } |
117 | 121 |
118 bool SpellCheckerProvidesPanel() { | 122 bool SpellCheckerProvidesPanel() { |
119 // OS X has a Spelling Panel, so we can return true here. | 123 // OS X has a Spelling Panel, so we can return true here. |
120 return true; | 124 return true; |
121 } | 125 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 300 |
297 ScopedEnglishLanguageForTest::ScopedEnglishLanguageForTest() | 301 ScopedEnglishLanguageForTest::ScopedEnglishLanguageForTest() |
298 : state_(new SpellcheckerStateInternal) { | 302 : state_(new SpellcheckerStateInternal) { |
299 } | 303 } |
300 | 304 |
301 ScopedEnglishLanguageForTest::~ScopedEnglishLanguageForTest() { | 305 ScopedEnglishLanguageForTest::~ScopedEnglishLanguageForTest() { |
302 delete state_; | 306 delete state_; |
303 } | 307 } |
304 | 308 |
305 } // namespace spellcheck_platform | 309 } // namespace spellcheck_platform |
OLD | NEW |