| OLD | NEW |
| 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 // 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 | 10 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 void RequestFinished(CheckClientDownloadRequest* request); | 171 void RequestFinished(CheckClientDownloadRequest* request); |
| 172 | 172 |
| 173 // Given a certificate and its immediate issuer certificate, generates the | 173 // Given a certificate and its immediate issuer certificate, generates the |
| 174 // list of strings that need to be checked against the download whitelist to | 174 // list of strings that need to be checked against the download whitelist to |
| 175 // determine whether the certificate is whitelisted. | 175 // determine whether the certificate is whitelisted. |
| 176 static void GetCertificateWhitelistStrings( | 176 static void GetCertificateWhitelistStrings( |
| 177 const net::X509Certificate& certificate, | 177 const net::X509Certificate& certificate, |
| 178 const net::X509Certificate& issuer, | 178 const net::X509Certificate& issuer, |
| 179 std::vector<std::string>* whitelist_strings); | 179 std::vector<std::string>* whitelist_strings); |
| 180 | 180 |
| 181 // Returns the URL that will be used for download requests. |
| 182 static std::string GetDownloadRequestUrl(); |
| 183 |
| 181 // This pointer may be NULL if SafeBrowsing is disabled. The | 184 // This pointer may be NULL if SafeBrowsing is disabled. The |
| 182 // SafeBrowsingService owns us, so we don't need to hold a reference to it. | 185 // SafeBrowsingService owns us, so we don't need to hold a reference to it. |
| 183 SafeBrowsingService* sb_service_; | 186 SafeBrowsingService* sb_service_; |
| 184 | 187 |
| 185 // The context we use to issue network requests. | 188 // The context we use to issue network requests. |
| 186 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 189 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 187 | 190 |
| 188 // Map of client download request to the corresponding callback that | 191 // Map of client download request to the corresponding callback that |
| 189 // has to be invoked when the request is done. This map contains all | 192 // has to be invoked when the request is done. This map contains all |
| 190 // pending server requests. | 193 // pending server requests. |
| 191 std::set<scoped_refptr<CheckClientDownloadRequest> > download_requests_; | 194 std::set<scoped_refptr<CheckClientDownloadRequest> > download_requests_; |
| 192 | 195 |
| 193 // Keeps track of the state of the service. | 196 // Keeps track of the state of the service. |
| 194 bool enabled_; | 197 bool enabled_; |
| 195 | 198 |
| 196 // SignatureUtil object, may be overridden for testing. | 199 // SignatureUtil object, may be overridden for testing. |
| 197 scoped_refptr<SignatureUtil> signature_util_; | 200 scoped_refptr<SignatureUtil> signature_util_; |
| 198 | 201 |
| 199 int64 download_request_timeout_ms_; | 202 int64 download_request_timeout_ms_; |
| 200 | 203 |
| 201 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); | 204 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); |
| 202 }; | 205 }; |
| 203 } // namespace safe_browsing | 206 } // namespace safe_browsing |
| 204 | 207 |
| 205 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ | 208 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ |
| OLD | NEW |