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 12 matching lines...) Expand all Loading... |
23 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
24 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
26 #include "chrome/common/spellcheck_common.h" | 26 #include "chrome/common/spellcheck_common.h" |
27 #include "chrome/common/spellcheck_messages.h" | 27 #include "chrome/common/spellcheck_messages.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/notification_types.h" | 29 #include "content/public/browser/notification_types.h" |
30 #include "content/public/browser/render_process_host.h" | 30 #include "content/public/browser/render_process_host.h" |
31 #include "content/public/common/url_fetcher.h" | 31 #include "content/public/common/url_fetcher.h" |
32 #include "googleurl/src/gurl.h" | 32 #include "googleurl/src/gurl.h" |
| 33 #include "net/base/load_flags.h" |
33 #include "net/url_request/url_request_context_getter.h" | 34 #include "net/url_request/url_request_context_getter.h" |
34 #include "third_party/hunspell/google/bdict.h" | 35 #include "third_party/hunspell/google/bdict.h" |
35 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
36 | 37 |
37 using content::BrowserThread; | 38 using content::BrowserThread; |
38 | 39 |
39 namespace { | 40 namespace { |
40 | 41 |
41 FilePath GetFirstChoiceFilePath(const std::string& language) { | 42 FilePath GetFirstChoiceFilePath(const std::string& language) { |
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 std::string bdict_file = bdict_file_path_.BaseName().MaybeAsASCII(); | 278 std::string bdict_file = bdict_file_path_.BaseName().MaybeAsASCII(); |
278 if (bdict_file.empty()) { | 279 if (bdict_file.empty()) { |
279 NOTREACHED(); | 280 NOTREACHED(); |
280 return; | 281 return; |
281 } | 282 } |
282 GURL url = GURL(std::string(kDownloadServerUrl) + | 283 GURL url = GURL(std::string(kDownloadServerUrl) + |
283 StringToLowerASCII(bdict_file)); | 284 StringToLowerASCII(bdict_file)); |
284 fetcher_.reset(content::URLFetcher::Create(url, content::URLFetcher::GET, | 285 fetcher_.reset(content::URLFetcher::Create(url, content::URLFetcher::GET, |
285 weak_ptr_factory_.GetWeakPtr())); | 286 weak_ptr_factory_.GetWeakPtr())); |
286 fetcher_->SetRequestContext(request_context_getter_); | 287 fetcher_->SetRequestContext(request_context_getter_); |
| 288 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
287 tried_to_download_ = true; | 289 tried_to_download_ = true; |
288 fetcher_->Start(); | 290 fetcher_->Start(); |
289 request_context_getter_ = NULL; | 291 request_context_getter_ = NULL; |
290 } | 292 } |
291 | 293 |
292 void SpellCheckHostImpl::LoadCustomDictionary(CustomWordList* custom_words) { | 294 void SpellCheckHostImpl::LoadCustomDictionary(CustomWordList* custom_words) { |
293 if (!custom_words) | 295 if (!custom_words) |
294 return; | 296 return; |
295 | 297 |
296 // Load custom dictionary for profile. | 298 // Load custom dictionary for profile. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 449 |
448 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { | 450 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { |
449 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 451 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
450 | 452 |
451 for (content::RenderProcessHost::iterator i( | 453 for (content::RenderProcessHost::iterator i( |
452 content::RenderProcessHost::AllHostsIterator()); | 454 content::RenderProcessHost::AllHostsIterator()); |
453 !i.IsAtEnd(); i.Advance()) { | 455 !i.IsAtEnd(); i.Advance()) { |
454 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); | 456 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); |
455 } | 457 } |
456 } | 458 } |
OLD | NEW |