| 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 10 matching lines...) Expand all Loading... |
| 21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 class URLRequestContextGetter; | 24 class URLRequestContextGetter; |
| 25 class URLRequestStatus; | 25 class URLRequestStatus; |
| 26 } // namespace net | 26 } // namespace net |
| 27 class DownloadItem; | 27 class DownloadItem; |
| 28 class SafeBrowsingService; | 28 class SafeBrowsingService; |
| 29 | 29 |
| 30 namespace safe_browsing { | 30 namespace safe_browsing { |
| 31 class SignatureUtil; |
| 31 | 32 |
| 32 // This class provides an asynchronous API to check whether a particular | 33 // This class provides an asynchronous API to check whether a particular |
| 33 // client download is malicious or not. | 34 // client download is malicious or not. |
| 34 class DownloadProtectionService { | 35 class DownloadProtectionService { |
| 35 public: | 36 public: |
| 36 // TODO(noelutz): we're missing some fields here: server IPs, | 37 // TODO(noelutz): we're missing some fields here: server IPs, |
| 37 // tab URL redirect chain, ... | 38 // tab URL redirect chain, ... |
| 38 struct DownloadInfo { | 39 struct DownloadInfo { |
| 39 FilePath local_file; | 40 FilePath local_file; |
| 40 std::vector<GURL> download_url_chain; | 41 std::vector<GURL> download_url_chain; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 135 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 135 | 136 |
| 136 // Map of client download request to the corresponding callback that | 137 // Map of client download request to the corresponding callback that |
| 137 // has to be invoked when the request is done. This map contains all | 138 // has to be invoked when the request is done. This map contains all |
| 138 // pending server requests. | 139 // pending server requests. |
| 139 std::set<scoped_refptr<CheckClientDownloadRequest> > download_requests_; | 140 std::set<scoped_refptr<CheckClientDownloadRequest> > download_requests_; |
| 140 | 141 |
| 141 // Keeps track of the state of the service. | 142 // Keeps track of the state of the service. |
| 142 bool enabled_; | 143 bool enabled_; |
| 143 | 144 |
| 145 // SignatureUtil object, may be overridden for testing. |
| 146 scoped_refptr<SignatureUtil> signature_util_; |
| 147 |
| 144 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); | 148 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); |
| 145 }; | 149 }; |
| 146 } // namespace safe_browsing | 150 } // namespace safe_browsing |
| 147 | 151 |
| 148 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 152 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
| OLD | NEW |