| 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/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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 DownloadProtectionService::DownloadInfo::DownloadInfo() | 110 DownloadProtectionService::DownloadInfo::DownloadInfo() |
| 111 : total_bytes(0), user_initiated(false) {} | 111 : total_bytes(0), user_initiated(false) {} |
| 112 | 112 |
| 113 DownloadProtectionService::DownloadInfo::~DownloadInfo() {} | 113 DownloadProtectionService::DownloadInfo::~DownloadInfo() {} |
| 114 | 114 |
| 115 // static | 115 // static |
| 116 DownloadProtectionService::DownloadInfo | 116 DownloadProtectionService::DownloadInfo |
| 117 DownloadProtectionService::DownloadInfo::FromDownloadItem( | 117 DownloadProtectionService::DownloadInfo::FromDownloadItem( |
| 118 const DownloadItem& item) { | 118 const DownloadItem& item) { |
| 119 DownloadInfo download_info; | 119 DownloadInfo download_info; |
| 120 download_info.local_file = item.full_path(); | 120 download_info.local_file = item.GetFullPath(); |
| 121 download_info.download_url_chain = item.url_chain(); | 121 download_info.download_url_chain = item.GetUrlChain(); |
| 122 download_info.referrer_url = item.referrer_url(); | 122 download_info.referrer_url = item.GetReferrerUrl(); |
| 123 // TODO(bryner): Fill in the hash (we shouldn't compute it again) | 123 // TODO(bryner): Fill in the hash (we shouldn't compute it again) |
| 124 download_info.total_bytes = item.total_bytes(); | 124 download_info.total_bytes = item.GetTotalBytes(); |
| 125 // TODO(bryner): Populate user_initiated | 125 // TODO(bryner): Populate user_initiated |
| 126 return download_info; | 126 return download_info; |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Parent SafeBrowsing::Client class used to lookup the bad binary | 129 // Parent SafeBrowsing::Client class used to lookup the bad binary |
| 130 // URL and digest list. There are two sub-classes (one for each list). | 130 // URL and digest list. There are two sub-classes (one for each list). |
| 131 class DownloadSBClient | 131 class DownloadSBClient |
| 132 : public SafeBrowsingService::Client, | 132 : public SafeBrowsingService::Client, |
| 133 public base::RefCountedThreadSafe<DownloadSBClient> { | 133 public base::RefCountedThreadSafe<DownloadSBClient> { |
| 134 public: | 134 public: |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 620 |
| 621 void DownloadProtectionService::RequestFinished( | 621 void DownloadProtectionService::RequestFinished( |
| 622 CheckClientDownloadRequest* request) { | 622 CheckClientDownloadRequest* request) { |
| 623 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 623 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 624 std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it = | 624 std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it = |
| 625 download_requests_.find(request); | 625 download_requests_.find(request); |
| 626 DCHECK(it != download_requests_.end()); | 626 DCHECK(it != download_requests_.end()); |
| 627 download_requests_.erase(*it); | 627 download_requests_.erase(*it); |
| 628 } | 628 } |
| 629 } // namespace safe_browsing | 629 } // namespace safe_browsing |
| OLD | NEW |