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

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

Issue 10392192: Remove content::URLFetcherDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup Created 8 years, 7 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"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/safe_browsing/signature_util.h" 21 #include "chrome/browser/safe_browsing/signature_util.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_list.h"
24 #include "chrome/common/safe_browsing/csd.pb.h" 24 #include "chrome/common/safe_browsing/csd.pb.h"
25 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
26 #include "chrome/common/zip_reader.h" 26 #include "chrome/common/zip_reader.h"
27 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/download_item.h" 28 #include "content/public/browser/download_item.h"
29 #include "content/public/browser/page_navigator.h" 29 #include "content/public/browser/page_navigator.h"
30 #include "content/public/common/url_fetcher.h" 30 #include "content/public/common/url_fetcher.h"
31 #include "content/public/common/url_fetcher_delegate.h"
32 #include "net/base/load_flags.h" 31 #include "net/base/load_flags.h"
33 #include "net/base/x509_cert_types.h" 32 #include "net/base/x509_cert_types.h"
34 #include "net/base/x509_certificate.h" 33 #include "net/base/x509_certificate.h"
35 #include "net/http/http_status_code.h" 34 #include "net/http/http_status_code.h"
35 #include "net/url_request/url_fetcher_delegate.h"
36 #include "net/url_request/url_request_context_getter.h" 36 #include "net/url_request/url_request_context_getter.h"
37 #include "net/url_request/url_request_status.h" 37 #include "net/url_request/url_request_status.h"
38 38
39 using content::BrowserThread; 39 using content::BrowserThread;
40 40
41 namespace { 41 namespace {
42 static const int64 kDownloadRequestTimeoutMs = 3000; 42 static const int64 kDownloadRequestTimeoutMs = 3000;
43 } // namespace 43 } // namespace
44 44
45 namespace safe_browsing { 45 namespace safe_browsing {
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 virtual ~DownloadUrlSBClient() {} 324 virtual ~DownloadUrlSBClient() {}
325 325
326 private: 326 private:
327 DISALLOW_COPY_AND_ASSIGN(DownloadUrlSBClient); 327 DISALLOW_COPY_AND_ASSIGN(DownloadUrlSBClient);
328 }; 328 };
329 329
330 class DownloadProtectionService::CheckClientDownloadRequest 330 class DownloadProtectionService::CheckClientDownloadRequest
331 : public base::RefCountedThreadSafe< 331 : public base::RefCountedThreadSafe<
332 DownloadProtectionService::CheckClientDownloadRequest, 332 DownloadProtectionService::CheckClientDownloadRequest,
333 BrowserThread::DeleteOnUIThread>, 333 BrowserThread::DeleteOnUIThread>,
334 public content::URLFetcherDelegate { 334 public net::URLFetcherDelegate {
335 public: 335 public:
336 CheckClientDownloadRequest(const DownloadInfo& info, 336 CheckClientDownloadRequest(const DownloadInfo& info,
337 const CheckDownloadCallback& callback, 337 const CheckDownloadCallback& callback,
338 DownloadProtectionService* service, 338 DownloadProtectionService* service,
339 SafeBrowsingService* sb_service, 339 SafeBrowsingService* sb_service,
340 SignatureUtil* signature_util) 340 SignatureUtil* signature_util)
341 : info_(info), 341 : info_(info),
342 callback_(callback), 342 callback_(callback),
343 service_(service), 343 service_(service),
344 signature_util_(signature_util), 344 signature_util_(signature_util),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 // fetcher so it does not try to invoke OnURLFetchComplete. 414 // fetcher so it does not try to invoke OnURLFetchComplete.
415 fetcher_.reset(); 415 fetcher_.reset();
416 } 416 }
417 // Note: If there is no fetcher, then some callback is still holding a 417 // Note: If there is no fetcher, then some callback is still holding a
418 // reference to this object. We'll eventually wind up in some method on 418 // reference to this object. We'll eventually wind up in some method on
419 // the UI thread that will call FinishRequest() again. If FinishRequest() 419 // the UI thread that will call FinishRequest() again. If FinishRequest()
420 // is called a second time, it will be a no-op. 420 // is called a second time, it will be a no-op.
421 service_ = NULL; 421 service_ = NULL;
422 } 422 }
423 423
424 // From the content::URLFetcherDelegate interface. 424 // From the net::URLFetcherDelegate interface.
425 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { 425 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE {
426 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 426 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
427 DCHECK_EQ(source, fetcher_.get()); 427 DCHECK_EQ(source, fetcher_.get());
428 VLOG(2) << "Received a response for URL: " 428 VLOG(2) << "Received a response for URL: "
429 << info_.download_url_chain.back() << ": success=" 429 << info_.download_url_chain.back() << ": success="
430 << source->GetStatus().is_success() << " response_code=" 430 << source->GetStatus().is_success() << " response_code="
431 << source->GetResponseCode(); 431 << source->GetResponseCode();
432 DownloadCheckResultReason reason = REASON_SERVER_PING_FAILED; 432 DownloadCheckResultReason reason = REASON_SERVER_PING_FAILED;
433 DownloadCheckResult result = SAFE; 433 DownloadCheckResult result = SAFE;
434 if (source->GetStatus().is_success() && 434 if (source->GetStatus().is_success() &&
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 943
944 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, 944 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data,
945 sizeof(issuer.fingerprint().data)); 945 sizeof(issuer.fingerprint().data));
946 for (std::set<std::string>::iterator it = paths_to_check.begin(); 946 for (std::set<std::string>::iterator it = paths_to_check.begin();
947 it != paths_to_check.end(); ++it) { 947 it != paths_to_check.end(); ++it) {
948 whitelist_strings->push_back("cert/" + issuer_fp + *it); 948 whitelist_strings->push_back("cert/" + issuer_fp + *it);
949 } 949 }
950 } 950 }
951 951
952 } // namespace safe_browsing 952 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698