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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" | 21 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" |
22 #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" | 22 #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" |
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/content_url_request_user_data.h" |
31 #include "content/public/common/url_fetcher.h" | 32 #include "content/public/common/url_fetcher.h" |
32 #include "googleurl/src/gurl.h" | 33 #include "googleurl/src/gurl.h" |
33 #include "net/base/load_flags.h" | 34 #include "net/base/load_flags.h" |
34 #include "net/url_request/url_request_context_getter.h" | 35 #include "net/url_request/url_request_context_getter.h" |
35 #include "third_party/hunspell/google/bdict.h" | 36 #include "third_party/hunspell/google/bdict.h" |
36 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
37 | 38 |
38 using content::BrowserThread; | 39 using content::BrowserThread; |
39 | 40 |
40 namespace { | 41 namespace { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 std::string bdict_file = bdict_file_path_.BaseName().MaybeAsASCII(); | 279 std::string bdict_file = bdict_file_path_.BaseName().MaybeAsASCII(); |
279 if (bdict_file.empty()) { | 280 if (bdict_file.empty()) { |
280 NOTREACHED(); | 281 NOTREACHED(); |
281 return; | 282 return; |
282 } | 283 } |
283 GURL url = GURL(std::string(kDownloadServerUrl) + | 284 GURL url = GURL(std::string(kDownloadServerUrl) + |
284 StringToLowerASCII(bdict_file)); | 285 StringToLowerASCII(bdict_file)); |
285 fetcher_.reset(content::URLFetcher::Create(url, content::URLFetcher::GET, | 286 fetcher_.reset(content::URLFetcher::Create(url, content::URLFetcher::GET, |
286 weak_ptr_factory_.GetWeakPtr())); | 287 weak_ptr_factory_.GetWeakPtr())); |
287 fetcher_->SetRequestContext(request_context_getter_); | 288 fetcher_->SetRequestContext(request_context_getter_); |
| 289 // TODO(jochen): Do cookie audit. |
| 290 fetcher_->SetContentURLRequestUserData( |
| 291 new content::ContentURLRequestUserData()); |
288 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | 292 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
289 tried_to_download_ = true; | 293 tried_to_download_ = true; |
290 fetcher_->Start(); | 294 fetcher_->Start(); |
291 request_context_getter_ = NULL; | 295 request_context_getter_ = NULL; |
292 } | 296 } |
293 | 297 |
294 void SpellCheckHostImpl::LoadCustomDictionary(CustomWordList* custom_words) { | 298 void SpellCheckHostImpl::LoadCustomDictionary(CustomWordList* custom_words) { |
295 if (!custom_words) | 299 if (!custom_words) |
296 return; | 300 return; |
297 | 301 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 453 |
450 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { | 454 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { |
451 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
452 | 456 |
453 for (content::RenderProcessHost::iterator i( | 457 for (content::RenderProcessHost::iterator i( |
454 content::RenderProcessHost::AllHostsIterator()); | 458 content::RenderProcessHost::AllHostsIterator()); |
455 !i.IsAtEnd(); i.Advance()) { | 459 !i.IsAtEnd(); i.Advance()) { |
456 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); | 460 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); |
457 } | 461 } |
458 } | 462 } |
OLD | NEW |