| 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_host_impl.h" | 5 #include "chrome/browser/spellchecker/spellcheck_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // Determine URL of file to download. | 275 // Determine URL of file to download. |
| 276 static const char kDownloadServerUrl[] = | 276 static const char kDownloadServerUrl[] = |
| 277 "http://cache.pack.google.com/edgedl/chrome/dict/"; | 277 "http://cache.pack.google.com/edgedl/chrome/dict/"; |
| 278 std::string bdict_file = bdict_file_path_.BaseName().MaybeAsASCII(); | 278 std::string bdict_file = bdict_file_path_.BaseName().MaybeAsASCII(); |
| 279 if (bdict_file.empty()) { | 279 if (bdict_file.empty()) { |
| 280 NOTREACHED(); | 280 NOTREACHED(); |
| 281 return; | 281 return; |
| 282 } | 282 } |
| 283 GURL url = GURL(std::string(kDownloadServerUrl) + | 283 GURL url = GURL(std::string(kDownloadServerUrl) + |
| 284 StringToLowerASCII(bdict_file)); | 284 StringToLowerASCII(bdict_file)); |
| 285 fetcher_.reset(content::URLFetcher::Create(url, content::URLFetcher::GET, | 285 fetcher_.reset(content::URLFetcher::Create(url, net::URLFetcher::GET, |
| 286 weak_ptr_factory_.GetWeakPtr())); | 286 weak_ptr_factory_.GetWeakPtr())); |
| 287 fetcher_->SetRequestContext(request_context_getter_); | 287 fetcher_->SetRequestContext(request_context_getter_); |
| 288 fetcher_->SetLoadFlags( | 288 fetcher_->SetLoadFlags( |
| 289 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); | 289 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); |
| 290 tried_to_download_ = true; | 290 tried_to_download_ = true; |
| 291 fetcher_->Start(); | 291 fetcher_->Start(); |
| 292 request_context_getter_ = NULL; | 292 request_context_getter_ = NULL; |
| 293 } | 293 } |
| 294 | 294 |
| 295 void SpellCheckHostImpl::LoadCustomDictionary(CustomWordList* custom_words) { | 295 void SpellCheckHostImpl::LoadCustomDictionary(CustomWordList* custom_words) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { | 451 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { |
| 452 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 452 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 453 | 453 |
| 454 for (content::RenderProcessHost::iterator i( | 454 for (content::RenderProcessHost::iterator i( |
| 455 content::RenderProcessHost::AllHostsIterator()); | 455 content::RenderProcessHost::AllHostsIterator()); |
| 456 !i.IsAtEnd(); i.Advance()) { | 456 !i.IsAtEnd(); i.Advance()) { |
| 457 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); | 457 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); |
| 458 } | 458 } |
| 459 } | 459 } |
| OLD | NEW |