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/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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 "TODO", | 139 "TODO", |
140 total_bytes, | 140 total_bytes, |
141 user_initiated ? "true" : "false"); | 141 user_initiated ? "true" : "false"); |
142 } | 142 } |
143 | 143 |
144 // static | 144 // static |
145 DownloadProtectionService::DownloadInfo | 145 DownloadProtectionService::DownloadInfo |
146 DownloadProtectionService::DownloadInfo::FromDownloadItem( | 146 DownloadProtectionService::DownloadInfo::FromDownloadItem( |
147 const DownloadItem& item) { | 147 const DownloadItem& item) { |
148 DownloadInfo download_info; | 148 DownloadInfo download_info; |
149 download_info.local_file = item.full_path(); | |
150 download_info.target_file = item.GetTargetFilePath(); | 149 download_info.target_file = item.GetTargetFilePath(); |
151 download_info.download_url_chain = item.url_chain(); | 150 download_info.sha256_hash = item.GetHash(); |
152 download_info.referrer_url = item.referrer_url(); | 151 download_info.local_file = item.GetFullPath(); |
153 download_info.sha256_hash = item.hash(); | 152 download_info.download_url_chain = item.GetUrlChain(); |
154 download_info.total_bytes = item.total_bytes(); | 153 download_info.referrer_url = item.GetReferrerUrl(); |
| 154 download_info.total_bytes = item.GetTotalBytes(); |
155 // TODO(bryner): Populate user_initiated | 155 // TODO(bryner): Populate user_initiated |
156 return download_info; | 156 return download_info; |
157 } | 157 } |
158 | 158 |
159 // Parent SafeBrowsing::Client class used to lookup the bad binary | 159 // Parent SafeBrowsing::Client class used to lookup the bad binary |
160 // URL and digest list. There are two sub-classes (one for each list). | 160 // URL and digest list. There are two sub-classes (one for each list). |
161 class DownloadSBClient | 161 class DownloadSBClient |
162 : public SafeBrowsingService::Client, | 162 : public SafeBrowsingService::Client, |
163 public base::RefCountedThreadSafe<DownloadSBClient> { | 163 public base::RefCountedThreadSafe<DownloadSBClient> { |
164 public: | 164 public: |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 | 693 |
694 void DownloadProtectionService::RequestFinished( | 694 void DownloadProtectionService::RequestFinished( |
695 CheckClientDownloadRequest* request) { | 695 CheckClientDownloadRequest* request) { |
696 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 696 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
697 std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it = | 697 std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it = |
698 download_requests_.find(request); | 698 download_requests_.find(request); |
699 DCHECK(it != download_requests_.end()); | 699 DCHECK(it != download_requests_.end()); |
700 download_requests_.erase(*it); | 700 download_requests_.erase(*it); |
701 } | 701 } |
702 } // namespace safe_browsing | 702 } // namespace safe_browsing |
OLD | NEW |