| 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 // Helper class which handles communication with the SafeBrowsing servers for | 5 // Helper class which handles communication with the SafeBrowsing servers for |
| 6 // improved binary download protection. | 6 // improved binary download protection. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
| 9 #define CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 namespace safe_browsing { | 30 namespace safe_browsing { |
| 31 class SignatureUtil; | 31 class SignatureUtil; |
| 32 | 32 |
| 33 // This class provides an asynchronous API to check whether a particular | 33 // This class provides an asynchronous API to check whether a particular |
| 34 // client download is malicious or not. | 34 // client download is malicious or not. |
| 35 class DownloadProtectionService { | 35 class DownloadProtectionService { |
| 36 public: | 36 public: |
| 37 // TODO(noelutz): we're missing some fields here: server IPs, | 37 // TODO(noelutz): we're missing some fields here: server IPs, |
| 38 // tab URL redirect chain, ... | 38 // tab URL redirect chain, ... |
| 39 struct DownloadInfo { | 39 struct DownloadInfo { |
| 40 FilePath local_file; | 40 FilePath local_file; // Where the download is currently stored. |
| 41 FilePath target_file; // Where the download will eventually be stored. |
| 41 std::vector<GURL> download_url_chain; | 42 std::vector<GURL> download_url_chain; |
| 42 GURL referrer_url; | 43 GURL referrer_url; |
| 43 std::string sha256_hash; | 44 std::string sha256_hash; |
| 44 int64 total_bytes; | 45 int64 total_bytes; |
| 45 bool user_initiated; | 46 bool user_initiated; |
| 46 DownloadInfo(); | 47 DownloadInfo(); |
| 47 ~DownloadInfo(); | 48 ~DownloadInfo(); |
| 48 | 49 std::string DebugString() const; |
| 49 // Creates a DownloadInfo from a DownloadItem object. | 50 // Creates a DownloadInfo from a DownloadItem object. |
| 50 static DownloadInfo FromDownloadItem(const DownloadItem& item); | 51 static DownloadInfo FromDownloadItem(const DownloadItem& item); |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 enum DownloadCheckResult { | 54 enum DownloadCheckResult { |
| 54 SAFE, | 55 SAFE, |
| 55 DANGEROUS, | 56 DANGEROUS, |
| 56 // In the future we may introduce a third category which corresponds to | 57 // In the future we may introduce a third category which corresponds to |
| 57 // suspicious downloads that are not known to be malicious. | 58 // suspicious downloads that are not known to be malicious. |
| 58 }; | 59 }; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 bool enabled_; | 156 bool enabled_; |
| 156 | 157 |
| 157 // SignatureUtil object, may be overridden for testing. | 158 // SignatureUtil object, may be overridden for testing. |
| 158 scoped_refptr<SignatureUtil> signature_util_; | 159 scoped_refptr<SignatureUtil> signature_util_; |
| 159 | 160 |
| 160 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); | 161 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); |
| 161 }; | 162 }; |
| 162 } // namespace safe_browsing | 163 } // namespace safe_browsing |
| 163 | 164 |
| 164 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 165 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
| OLD | NEW |