OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 11 matching lines...) Expand all Loading... |
22 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
25 #include "chrome/common/spellcheck_common.h" | 25 #include "chrome/common/spellcheck_common.h" |
26 #include "chrome/common/spellcheck_messages.h" | 26 #include "chrome/common/spellcheck_messages.h" |
27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
28 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
29 #include "content/public/browser/render_process_host.h" | 29 #include "content/public/browser/render_process_host.h" |
30 #include "content/public/common/url_fetcher.h" | 30 #include "content/public/common/url_fetcher.h" |
31 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
| 32 #include "net/base/load_flags.h" |
32 #include "net/url_request/url_request_context_getter.h" | 33 #include "net/url_request/url_request_context_getter.h" |
33 #include "third_party/hunspell/google/bdict.h" | 34 #include "third_party/hunspell/google/bdict.h" |
34 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
35 #if defined(OS_MACOSX) | 36 #if defined(OS_MACOSX) |
36 #include "base/metrics/histogram.h" | 37 #include "base/metrics/histogram.h" |
37 #endif | 38 #endif |
38 | 39 |
39 using content::BrowserThread; | 40 using content::BrowserThread; |
40 | 41 |
41 namespace { | 42 namespace { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 std::string bdict_file = bdict_file_path_.BaseName().MaybeAsASCII(); | 311 std::string bdict_file = bdict_file_path_.BaseName().MaybeAsASCII(); |
311 if (bdict_file.empty()) { | 312 if (bdict_file.empty()) { |
312 NOTREACHED(); | 313 NOTREACHED(); |
313 return; | 314 return; |
314 } | 315 } |
315 GURL url = GURL(std::string(kDownloadServerUrl) + | 316 GURL url = GURL(std::string(kDownloadServerUrl) + |
316 StringToLowerASCII(bdict_file)); | 317 StringToLowerASCII(bdict_file)); |
317 fetcher_.reset(content::URLFetcher::Create(url, content::URLFetcher::GET, | 318 fetcher_.reset(content::URLFetcher::Create(url, content::URLFetcher::GET, |
318 weak_ptr_factory_.GetWeakPtr())); | 319 weak_ptr_factory_.GetWeakPtr())); |
319 fetcher_->SetRequestContext(request_context_getter_); | 320 fetcher_->SetRequestContext(request_context_getter_); |
| 321 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
320 tried_to_download_ = true; | 322 tried_to_download_ = true; |
321 fetcher_->Start(); | 323 fetcher_->Start(); |
322 request_context_getter_ = NULL; | 324 request_context_getter_ = NULL; |
323 } | 325 } |
324 | 326 |
325 void SpellCheckHostImpl::LoadCustomDictionary(CustomWordList* custom_words) { | 327 void SpellCheckHostImpl::LoadCustomDictionary(CustomWordList* custom_words) { |
326 if (!custom_words) | 328 if (!custom_words) |
327 return; | 329 return; |
328 | 330 |
329 // Load custom dictionary for profile. | 331 // Load custom dictionary for profile. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 482 |
481 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { | 483 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { |
482 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 484 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
483 | 485 |
484 for (content::RenderProcessHost::iterator i( | 486 for (content::RenderProcessHost::iterator i( |
485 content::RenderProcessHost::AllHostsIterator()); | 487 content::RenderProcessHost::AllHostsIterator()); |
486 !i.IsAtEnd(); i.Advance()) { | 488 !i.IsAtEnd(); i.Advance()) { |
487 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); | 489 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); |
488 } | 490 } |
489 } | 491 } |
OLD | NEW |