| 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/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 | 222 |
| 223 GURL SpellcheckHunspellDictionary::GetDictionaryURL() { | 223 GURL SpellcheckHunspellDictionary::GetDictionaryURL() { |
| 224 static const char kDownloadServerUrl[] = | 224 static const char kDownloadServerUrl[] = |
| 225 "https://redirector.gvt1.com/edgedl/chrome/dict/"; | 225 "https://redirector.gvt1.com/edgedl/chrome/dict/"; |
| 226 std::string bdict_file = dictionary_file_.path.BaseName().MaybeAsASCII(); | 226 std::string bdict_file = dictionary_file_.path.BaseName().MaybeAsASCII(); |
| 227 | 227 |
| 228 DCHECK(!bdict_file.empty()); | 228 DCHECK(!bdict_file.empty()); |
| 229 | 229 |
| 230 return GURL(std::string(kDownloadServerUrl) + | 230 return GURL(std::string(kDownloadServerUrl) + |
| 231 base::StringToLowerASCII(bdict_file)); | 231 base::ToLowerASCII(bdict_file)); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) { | 234 void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) { |
| 235 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 235 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 236 DCHECK(request_context_getter_); | 236 DCHECK(request_context_getter_); |
| 237 | 237 |
| 238 download_status_ = DOWNLOAD_IN_PROGRESS; | 238 download_status_ = DOWNLOAD_IN_PROGRESS; |
| 239 FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryDownloadBegin()); | 239 FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryDownloadBegin()); |
| 240 | 240 |
| 241 fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this); | 241 fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 void SpellcheckHunspellDictionary::InformListenersOfInitialization() { | 359 void SpellcheckHunspellDictionary::InformListenersOfInitialization() { |
| 360 FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryInitialized()); | 360 FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryInitialized()); |
| 361 } | 361 } |
| 362 | 362 |
| 363 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { | 363 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { |
| 364 download_status_ = DOWNLOAD_FAILED; | 364 download_status_ = DOWNLOAD_FAILED; |
| 365 FOR_EACH_OBSERVER(Observer, | 365 FOR_EACH_OBSERVER(Observer, |
| 366 observers_, | 366 observers_, |
| 367 OnHunspellDictionaryDownloadFailure()); | 367 OnHunspellDictionaryDownloadFailure()); |
| 368 } | 368 } |
| OLD | NEW |