diff options
Diffstat (limited to 'chrome/browser/spellchecker')
4 files changed, 34 insertions, 16 deletions
diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc index 5463f40..aad12e1 100644 --- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc @@ -139,6 +139,10 @@ void SpellcheckHunspellDictionary::Load() { void SpellcheckHunspellDictionary::RetryDownloadDictionary( net::URLRequestContextGetter* request_context_getter) { DCHECK_CURRENTLY_ON(BrowserThread::UI); + if (dictionary_file_.file.IsValid()) { + NOTREACHED(); + return; + } request_context_getter_ = request_context_getter; DownloadDictionary(GetDictionaryURL()); } @@ -236,7 +240,8 @@ void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) { DCHECK(request_context_getter_); download_status_ = DOWNLOAD_IN_PROGRESS; - FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryDownloadBegin()); + FOR_EACH_OBSERVER(Observer, observers_, + OnHunspellDictionaryDownloadBegin(language_)); fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this); fetcher_->SetRequestContext(request_context_getter_); @@ -348,7 +353,7 @@ void SpellcheckHunspellDictionary::SaveDictionaryDataComplete( download_status_ = DOWNLOAD_NONE; FOR_EACH_OBSERVER(Observer, observers_, - OnHunspellDictionaryDownloadSuccess()); + OnHunspellDictionaryDownloadSuccess(language_)); Load(); } else { InformListenersOfDownloadFailure(); @@ -357,12 +362,13 @@ void SpellcheckHunspellDictionary::SaveDictionaryDataComplete( } void SpellcheckHunspellDictionary::InformListenersOfInitialization() { - FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryInitialized()); + FOR_EACH_OBSERVER(Observer, observers_, + OnHunspellDictionaryInitialized(language_)); } void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { download_status_ = DOWNLOAD_FAILED; FOR_EACH_OBSERVER(Observer, observers_, - OnHunspellDictionaryDownloadFailure()); + OnHunspellDictionaryDownloadFailure(language_)); } diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h index 2a37a55..a2c5068 100644 --- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h +++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h @@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HUNSPELL_DICTIONARY_H_ #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HUNSPELL_DICTIONARY_H_ +#include <string> + #include "base/files/file.h" #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" @@ -32,16 +34,20 @@ class SpellcheckHunspellDictionary class Observer { public: // The dictionary has been initialized. - virtual void OnHunspellDictionaryInitialized() = 0; + virtual void OnHunspellDictionaryInitialized( + const std::string& language) = 0; // Dictionary download began. - virtual void OnHunspellDictionaryDownloadBegin() = 0; + virtual void OnHunspellDictionaryDownloadBegin( + const std::string& language) = 0; // Dictionary download succeeded. - virtual void OnHunspellDictionaryDownloadSuccess() = 0; + virtual void OnHunspellDictionaryDownloadSuccess( + const std::string& language) = 0; // Dictionary download failed. - virtual void OnHunspellDictionaryDownloadFailure() = 0; + virtual void OnHunspellDictionaryDownloadFailure( + const std::string& language) = 0; }; SpellcheckHunspellDictionary( diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc index 03aeaf3..1cebb74 100644 --- a/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chrome/browser/spellchecker/spellcheck_service.cc @@ -258,17 +258,21 @@ void SpellcheckService::OnCustomDictionaryChanged( } } -void SpellcheckService::OnHunspellDictionaryInitialized() { +void SpellcheckService::OnHunspellDictionaryInitialized( + const std::string& language) { InitForAllRenderers(); } -void SpellcheckService::OnHunspellDictionaryDownloadBegin() { +void SpellcheckService::OnHunspellDictionaryDownloadBegin( + const std::string& language) { } -void SpellcheckService::OnHunspellDictionaryDownloadSuccess() { +void SpellcheckService::OnHunspellDictionaryDownloadSuccess( + const std::string& language) { } -void SpellcheckService::OnHunspellDictionaryDownloadFailure() { +void SpellcheckService::OnHunspellDictionaryDownloadFailure( + const std::string& language) { } // static diff --git a/chrome/browser/spellchecker/spellcheck_service.h b/chrome/browser/spellchecker/spellcheck_service.h index 86805ce..81956f8 100644 --- a/chrome/browser/spellchecker/spellcheck_service.h +++ b/chrome/browser/spellchecker/spellcheck_service.h @@ -124,10 +124,12 @@ class SpellcheckService : public KeyedService, const SpellcheckCustomDictionary::Change& dictionary_change) override; // SpellcheckHunspellDictionary::Observer implementation. - void OnHunspellDictionaryInitialized() override; - void OnHunspellDictionaryDownloadBegin() override; - void OnHunspellDictionaryDownloadSuccess() override; - void OnHunspellDictionaryDownloadFailure() override; + void OnHunspellDictionaryInitialized(const std::string& language) override; + void OnHunspellDictionaryDownloadBegin(const std::string& language) override; + void OnHunspellDictionaryDownloadSuccess( + const std::string& language) override; + void OnHunspellDictionaryDownloadFailure( + const std::string& language) override; private: FRIEND_TEST_ALL_PREFIXES(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT); |