| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 261 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 262 | 262 |
| 263 if (!request_context_getter_) { | 263 if (!request_context_getter_) { |
| 264 InitializeOnFileThread(); | 264 InitializeOnFileThread(); |
| 265 return; | 265 return; |
| 266 } | 266 } |
| 267 | 267 |
| 268 // Determine URL of file to download. | 268 // Determine URL of file to download. |
| 269 static const char kDownloadServerUrl[] = | 269 static const char kDownloadServerUrl[] = |
| 270 "http://cache.pack.google.com/edgedl/chrome/dict/"; | 270 "http://cache.pack.google.com/edgedl/chrome/dict/"; |
| 271 std::string bdict_file = bdict_file_path_.BaseName().MaybeAsASCII(); |
| 272 if (bdict_file.empty()) { |
| 273 NOTREACHED(); |
| 274 return; |
| 275 } |
| 271 GURL url = GURL(std::string(kDownloadServerUrl) + | 276 GURL url = GURL(std::string(kDownloadServerUrl) + |
| 272 StringToLowerASCII(WideToUTF8( | 277 StringToLowerASCII(bdict_file)); |
| 273 bdict_file_path_.BaseName().ToWStringHack()))); | |
| 274 fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this)); | 278 fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this)); |
| 275 fetcher_->set_request_context(request_context_getter_); | 279 fetcher_->set_request_context(request_context_getter_); |
| 276 tried_to_download_ = true; | 280 tried_to_download_ = true; |
| 277 fetcher_->Start(); | 281 fetcher_->Start(); |
| 278 request_context_getter_ = NULL; | 282 request_context_getter_ = NULL; |
| 279 } | 283 } |
| 280 | 284 |
| 281 void SpellCheckHost::WriteWordToCustomDictionary(const std::string& word) { | 285 void SpellCheckHost::WriteWordToCustomDictionary(const std::string& word) { |
| 282 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 286 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 283 | 287 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 360 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 357 NewRunnableMethod(this, | 361 NewRunnableMethod(this, |
| 358 &SpellCheckHost::InformObserverOfInitialization)); | 362 &SpellCheckHost::InformObserverOfInitialization)); |
| 359 return; | 363 return; |
| 360 } | 364 } |
| 361 } | 365 } |
| 362 | 366 |
| 363 data_.clear(); | 367 data_.clear(); |
| 364 Initialize(); | 368 Initialize(); |
| 365 } | 369 } |
| OLD | NEW |