Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/safe_browsing/malware_details_cache.cc

Issue 9572001: Do cookie checks in NetworkDelegate instead of the URLRequest::Delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Implementation of the MalwareDetails class. 5 // Implementation of the MalwareDetails class.
6 6
7 #include "chrome/browser/safe_browsing/malware_details.h" 7 #include "chrome/browser/safe_browsing/malware_details.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/md5.h" 11 #include "base/md5.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "chrome/browser/net/chrome_url_request_context.h" 13 #include "chrome/browser/net/chrome_url_request_context.h"
14 #include "chrome/browser/safe_browsing/malware_details_cache.h" 14 #include "chrome/browser/safe_browsing/malware_details_cache.h"
15 #include "chrome/browser/safe_browsing/report.pb.h" 15 #include "chrome/browser/safe_browsing/report.pb.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/common/content_url_request_user_data.h"
18 #include "content/public/common/url_fetcher.h" 19 #include "content/public/common/url_fetcher.h"
19 #include "net/base/host_port_pair.h" 20 #include "net/base/host_port_pair.h"
20 #include "net/base/load_flags.h" 21 #include "net/base/load_flags.h"
21 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
22 #include "net/http/http_response_headers.h" 23 #include "net/http/http_response_headers.h"
23 #include "net/url_request/url_request_context_getter.h" 24 #include "net/url_request/url_request_context_getter.h"
24 #include "net/url_request/url_request_status.h" 25 #include "net/url_request/url_request_status.h"
25 26
26 using content::BrowserThread; 27 using content::BrowserThread;
27 using safe_browsing::ClientMalwareReportRequest; 28 using safe_browsing::ClientMalwareReportRequest;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 80
80 if (!request_context_getter_) { 81 if (!request_context_getter_) {
81 DVLOG(1) << "Missing request context getter"; 82 DVLOG(1) << "Missing request context getter";
82 AllDone(false); 83 AllDone(false);
83 return; 84 return;
84 } 85 }
85 86
86 current_fetch_.reset(content::URLFetcher::Create( 87 current_fetch_.reset(content::URLFetcher::Create(
87 GURL(resources_it_->first), content::URLFetcher::GET, this)); 88 GURL(resources_it_->first), content::URLFetcher::GET, this));
88 current_fetch_->SetRequestContext(request_context_getter_); 89 current_fetch_->SetRequestContext(request_context_getter_);
90 // TODO(jochen): Do cookie audit.
91 current_fetch_->SetContentURLRequestUserData(
92 new content::ContentURLRequestUserData());
89 // Only from cache, and don't save cookies. 93 // Only from cache, and don't save cookies.
90 current_fetch_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE | 94 current_fetch_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE |
91 net::LOAD_DO_NOT_SAVE_COOKIES); 95 net::LOAD_DO_NOT_SAVE_COOKIES);
92 current_fetch_->SetAutomaticallyRetryOn5xx(false); // No retries. 96 current_fetch_->SetAutomaticallyRetryOn5xx(false); // No retries.
93 current_fetch_->Start(); // OnURLFetchComplete will be called when done. 97 current_fetch_->Start(); // OnURLFetchComplete will be called when done.
94 } 98 }
95 99
96 ClientMalwareReportRequest::Resource* MalwareDetailsCacheCollector::GetResource( 100 ClientMalwareReportRequest::Resource* MalwareDetailsCacheCollector::GetResource(
97 const GURL& url) { 101 const GURL& url) {
98 safe_browsing::ResourceMap::iterator it = resources_->find(url.spec()); 102 safe_browsing::ResourceMap::iterator it = resources_->find(url.spec());
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this)); 206 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this));
203 } 207 }
204 208
205 void MalwareDetailsCacheCollector::AllDone(bool success) { 209 void MalwareDetailsCacheCollector::AllDone(bool success) {
206 DVLOG(1) << "AllDone"; 210 DVLOG(1) << "AllDone";
207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
208 *result_ = success; 212 *result_ = success;
209 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); 213 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_);
210 callback_.Reset(); 214 callback_.Reset();
211 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698