| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/spellcheck_host.h" | 5 #include "chrome/browser/spellcheck_host.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 213 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 214 | 214 |
| 215 if (!request_context_getter_) { | 215 if (!request_context_getter_) { |
| 216 InitializeOnFileThread(); | 216 InitializeOnFileThread(); |
| 217 return; | 217 return; |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Determine URL of file to download. | 220 // Determine URL of file to download. |
| 221 static const char kDownloadServerUrl[] = | 221 static const char kDownloadServerUrl[] = |
| 222 "http://cache.pack.google.com/edgedl/chrome/dict/"; | 222 "http://cache.pack.google.com/edgedl/chrome/dict/"; |
| 223 GURL url = GURL(std::string(kDownloadServerUrl) + WideToUTF8( | 223 GURL url = GURL(std::string(kDownloadServerUrl) + |
| 224 l10n_util::ToLower(bdict_file_path_.BaseName().ToWStringHack()))); | 224 StringToLowerASCII(WideToUTF8( |
| 225 bdict_file_path_.BaseName().ToWStringHack()))); |
| 225 fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this)); | 226 fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this)); |
| 226 fetcher_->set_request_context(request_context_getter_); | 227 fetcher_->set_request_context(request_context_getter_); |
| 227 tried_to_download_ = true; | 228 tried_to_download_ = true; |
| 228 fetcher_->Start(); | 229 fetcher_->Start(); |
| 229 request_context_getter_ = NULL; | 230 request_context_getter_ = NULL; |
| 230 } | 231 } |
| 231 | 232 |
| 232 void SpellCheckHost::WriteWordToCustomDictionary(const std::string& word) { | 233 void SpellCheckHost::WriteWordToCustomDictionary(const std::string& word) { |
| 233 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); | 234 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); |
| 234 | 235 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, | 298 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, |
| 298 NewRunnableMethod(this, | 299 NewRunnableMethod(this, |
| 299 &SpellCheckHost::InformObserverOfInitialization)); | 300 &SpellCheckHost::InformObserverOfInitialization)); |
| 300 return; | 301 return; |
| 301 } | 302 } |
| 302 } | 303 } |
| 303 | 304 |
| 304 data_.clear(); | 305 data_.clear(); |
| 305 Initialize(); | 306 Initialize(); |
| 306 } | 307 } |
| OLD | NEW |