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

Side by Side Diff: chrome/browser/safe_browsing/download_protection_service.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) 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/safe_browsing/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop_helpers.h" 12 #include "base/message_loop_helpers.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 19 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
20 #include "chrome/browser/safe_browsing/signature_util.h" 20 #include "chrome/browser/safe_browsing/signature_util.h"
21 #include "chrome/common/safe_browsing/csd.pb.h" 21 #include "chrome/common/safe_browsing/csd.pb.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/download_item.h" 23 #include "content/public/browser/download_item.h"
24 #include "content/public/common/content_url_request_user_data.h"
24 #include "content/public/common/url_fetcher.h" 25 #include "content/public/common/url_fetcher.h"
25 #include "content/public/common/url_fetcher_delegate.h" 26 #include "content/public/common/url_fetcher_delegate.h"
26 #include "net/base/load_flags.h" 27 #include "net/base/load_flags.h"
27 #include "net/base/x509_cert_types.h" 28 #include "net/base/x509_cert_types.h"
28 #include "net/base/x509_certificate.h" 29 #include "net/base/x509_certificate.h"
29 #include "net/http/http_status_code.h" 30 #include "net/http/http_status_code.h"
30 #include "net/url_request/url_request_context_getter.h" 31 #include "net/url_request/url_request_context_getter.h"
31 #include "net/url_request/url_request_status.h" 32 #include "net/url_request/url_request_status.h"
32 33
33 using content::BrowserThread; 34 using content::BrowserThread;
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 597
597 VLOG(2) << "Sending a request for URL: " 598 VLOG(2) << "Sending a request for URL: "
598 << info_.download_url_chain.back(); 599 << info_.download_url_chain.back();
599 fetcher_.reset(content::URLFetcher::Create(0 /* ID used for testing */, 600 fetcher_.reset(content::URLFetcher::Create(0 /* ID used for testing */,
600 GURL(kDownloadRequestUrl), 601 GURL(kDownloadRequestUrl),
601 content::URLFetcher::POST, 602 content::URLFetcher::POST,
602 this)); 603 this));
603 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); 604 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
604 fetcher_->SetAutomaticallyRetryOn5xx(false); // Don't retry on error. 605 fetcher_->SetAutomaticallyRetryOn5xx(false); // Don't retry on error.
605 fetcher_->SetRequestContext(service_->request_context_getter_.get()); 606 fetcher_->SetRequestContext(service_->request_context_getter_.get());
607 // TODO(jochen): Do cookie audit.
608 fetcher_->SetContentURLRequestUserData(
609 new content::ContentURLRequestUserData());
606 fetcher_->SetUploadData("application/octet-stream", request_data); 610 fetcher_->SetUploadData("application/octet-stream", request_data);
607 fetcher_->Start(); 611 fetcher_->Start();
608 } 612 }
609 613
610 void PostFinishTask(DownloadCheckResult result) { 614 void PostFinishTask(DownloadCheckResult result) {
611 BrowserThread::PostTask( 615 BrowserThread::PostTask(
612 BrowserThread::UI, 616 BrowserThread::UI,
613 FROM_HERE, 617 FROM_HERE,
614 base::Bind(&CheckClientDownloadRequest::FinishRequest, this, result)); 618 base::Bind(&CheckClientDownloadRequest::FinishRequest, this, result));
615 } 619 }
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 847
844 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, 848 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data,
845 sizeof(issuer.fingerprint().data)); 849 sizeof(issuer.fingerprint().data));
846 for (std::set<std::string>::iterator it = paths_to_check.begin(); 850 for (std::set<std::string>::iterator it = paths_to_check.begin();
847 it != paths_to_check.end(); ++it) { 851 it != paths_to_check.end(); ++it) {
848 whitelist_strings->push_back("cert/" + issuer_fp + *it); 852 whitelist_strings->push_back("cert/" + issuer_fp + *it);
849 } 853 }
850 } 854 }
851 855
852 } // namespace safe_browsing 856 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698