| 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 #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" | 5 #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/memory_mapped_file.h" | 8 #include "base/files/memory_mapped_file.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 175 } |
| 176 | 176 |
| 177 void SpellcheckHunspellDictionary::Load() { | 177 void SpellcheckHunspellDictionary::Load() { |
| 178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 179 | 179 |
| 180 #if defined(OS_MACOSX) | 180 #if defined(OS_MACOSX) |
| 181 if (spellcheck_mac::SpellCheckerAvailable() && | 181 if (spellcheck_mac::SpellCheckerAvailable() && |
| 182 spellcheck_mac::PlatformSupportsLanguage(language_)) { | 182 spellcheck_mac::PlatformSupportsLanguage(language_)) { |
| 183 use_platform_spellchecker_ = true; | 183 use_platform_spellchecker_ = true; |
| 184 spellcheck_mac::SetLanguage(language_); | 184 spellcheck_mac::SetLanguage(language_); |
| 185 MessageLoop::current()->PostTask(FROM_HERE, | 185 base::MessageLoop::current()->PostTask( |
| 186 FROM_HERE, |
| 186 base::Bind( | 187 base::Bind( |
| 187 &SpellcheckHunspellDictionary::InformListenersOfInitialization, | 188 &SpellcheckHunspellDictionary::InformListenersOfInitialization, |
| 188 weak_ptr_factory_.GetWeakPtr())); | 189 weak_ptr_factory_.GetWeakPtr())); |
| 189 return; | 190 return; |
| 190 } | 191 } |
| 191 #endif // OS_MACOSX | 192 #endif // OS_MACOSX |
| 192 | 193 |
| 193 BrowserThread::PostTaskAndReplyWithResult( | 194 BrowserThread::PostTaskAndReplyWithResult( |
| 194 BrowserThread::FILE, | 195 BrowserThread::FILE, |
| 195 FROM_HERE, | 196 FROM_HERE, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 void SpellcheckHunspellDictionary::InformListenersOfInitialization() { | 357 void SpellcheckHunspellDictionary::InformListenersOfInitialization() { |
| 357 FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryInitialized()); | 358 FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryInitialized()); |
| 358 } | 359 } |
| 359 | 360 |
| 360 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { | 361 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { |
| 361 download_status_ = DOWNLOAD_FAILED; | 362 download_status_ = DOWNLOAD_FAILED; |
| 362 FOR_EACH_OBSERVER(Observer, | 363 FOR_EACH_OBSERVER(Observer, |
| 363 observers_, | 364 observers_, |
| 364 OnHunspellDictionaryDownloadFailure()); | 365 OnHunspellDictionaryDownloadFailure()); |
| 365 } | 366 } |
| OLD | NEW |