diff options
4 files changed, 21 insertions, 3 deletions
diff --git a/chromium/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc b/chromium/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc index fc6c6a98b7c..737facca648 100644 --- a/chromium/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc +++ b/chromium/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc @@ -362,7 +362,9 @@ SpellcheckHunspellDictionary::OpenDictionaryFile(const base::FilePath& path) { dictionary.file.Initialize(dictionary.path, base::File::FLAG_READ | base::File::FLAG_OPEN); } else { +#ifndef TOOLKIT_QT base::DeleteFile(dictionary.path, false); +#endif } return dictionary; @@ -392,7 +394,7 @@ void SpellcheckHunspellDictionary::InitializeDictionaryLocationComplete( DictionaryFile file) { DCHECK_CURRENTLY_ON(BrowserThread::UI); dictionary_file_ = std::move(file); - +#ifndef TOOLKIT_QT if (!dictionary_file_.file.IsValid()) { // Notify browser tests that this dictionary is corrupted. Skip downloading // the dictionary in browser tests. @@ -411,6 +413,13 @@ void SpellcheckHunspellDictionary::InitializeDictionaryLocationComplete( } InformListenersOfInitialization(); +#else + if (!dictionary_file_.file.IsValid()) + // We never download, so safe to reuse this handler + InformListenersOfDownloadFailure(); + else + InformListenersOfInitialization(); +#endif } #endif // !defined(OS_ANDROID) diff --git a/chromium/chrome/browser/spellchecker/spellcheck_service.cc b/chromium/chrome/browser/spellchecker/spellcheck_service.cc index d66d4faf867..ef444bd5c6f 100644 --- a/chromium/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chromium/chrome/browser/spellchecker/spellcheck_service.cc @@ -316,6 +316,10 @@ void SpellcheckService::OnHunspellDictionaryDownloadSuccess( void SpellcheckService::OnHunspellDictionaryDownloadFailure( const std::string& language) { +#ifdef TOOLKIT_QT + DCHECK_CURRENTLY_ON(BrowserThread::UI); + context_->FailedToLoadDictionary(language); +#endif } // static diff --git a/chromium/components/spellcheck/common/spellcheck_common.cc b/chromium/components/spellcheck/common/spellcheck_common.cc index 4896516906c..0c676161b28 100644 --- a/chromium/components/spellcheck/common/spellcheck_common.cc +++ b/chromium/components/spellcheck/common/spellcheck_common.cc @@ -137,8 +137,7 @@ base::FilePath GetVersionedFileName(base::StringPiece input_language, } std::string versioned_bdict_file_name(language + version + ".bdic"); #else - std::string language = GetSpellCheckLanguageRegion(input_language); - std::string versioned_bdict_file_name(language + ".bdic"); + std::string versioned_bdict_file_name(input_language + ".bdic"); #endif return dict_dir.AppendASCII(versioned_bdict_file_name); } diff --git a/chromium/content/public/browser/browser_context.h b/chromium/content/public/browser/browser_context.h index ddb42286696..f51e88f5021 100644 --- a/chromium/content/public/browser/browser_context.h +++ b/chromium/content/public/browser/browser_context.h @@ -16,6 +16,7 @@ #include "base/callback_forward.h" #include "base/containers/hash_tables.h" #include "base/supports_user_data.h" +#include "components/spellcheck/spellcheck_buildflags.h" #include "content/common/content_export.h" #include "net/url_request/url_request_interceptor.h" #include "net/url_request/url_request_job_factory.h" @@ -316,6 +317,11 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { // directly, so privacy is not compromised. virtual media::VideoDecodePerfHistory* GetVideoDecodePerfHistory(); +#if defined(TOOLKIT_QT) && BUILDFLAG(ENABLE_SPELLCHECK) + // Inform about not working dictionary for given language + virtual void FailedToLoadDictionary(const std::string& language) = 0; +#endif + private: const std::string media_device_id_salt_; bool was_notify_will_be_destroyed_called_ = false; |