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 #include "chrome/browser/safe_browsing/download_protection_service.h" | 5 #include "chrome/browser/safe_browsing/download_protection_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <memory> |
| 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
11 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
12 #include "base/format_macros.h" | 14 #include "base/format_macros.h" |
13 #include "base/macros.h" | 15 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
16 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
18 #include "base/metrics/sparse_histogram.h" | 19 #include "base/metrics/sparse_histogram.h" |
19 #include "base/sequenced_task_runner_helpers.h" | 20 #include "base/sequenced_task_runner_helpers.h" |
20 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
21 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
24 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 // URL chain of redirects leading to (but not including) |tab_url|. | 1027 // URL chain of redirects leading to (but not including) |tab_url|. |
1027 std::vector<GURL> tab_redirects_; | 1028 std::vector<GURL> tab_redirects_; |
1028 // URL and referrer of the window the download was started from. | 1029 // URL and referrer of the window the download was started from. |
1029 GURL tab_url_; | 1030 GURL tab_url_; |
1030 GURL tab_referrer_url_; | 1031 GURL tab_referrer_url_; |
1031 | 1032 |
1032 bool archived_executable_; | 1033 bool archived_executable_; |
1033 ArchiveValid archive_is_valid_; | 1034 ArchiveValid archive_is_valid_; |
1034 | 1035 |
1035 ClientDownloadRequest_SignatureInfo signature_info_; | 1036 ClientDownloadRequest_SignatureInfo signature_info_; |
1036 scoped_ptr<ClientDownloadRequest_ImageHeaders> image_headers_; | 1037 std::unique_ptr<ClientDownloadRequest_ImageHeaders> image_headers_; |
1037 google::protobuf::RepeatedPtrField<ClientDownloadRequest_ArchivedBinary> | 1038 google::protobuf::RepeatedPtrField<ClientDownloadRequest_ArchivedBinary> |
1038 archived_binary_; | 1039 archived_binary_; |
1039 CheckDownloadCallback callback_; | 1040 CheckDownloadCallback callback_; |
1040 // Will be NULL if the request has been canceled. | 1041 // Will be NULL if the request has been canceled. |
1041 DownloadProtectionService* service_; | 1042 DownloadProtectionService* service_; |
1042 scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor_; | 1043 scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor_; |
1043 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; | 1044 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; |
1044 const bool pingback_enabled_; | 1045 const bool pingback_enabled_; |
1045 scoped_ptr<net::URLFetcher> fetcher_; | 1046 std::unique_ptr<net::URLFetcher> fetcher_; |
1046 scoped_refptr<SandboxedZipAnalyzer> analyzer_; | 1047 scoped_refptr<SandboxedZipAnalyzer> analyzer_; |
1047 base::TimeTicks zip_analysis_start_time_; | 1048 base::TimeTicks zip_analysis_start_time_; |
1048 #if defined(OS_MACOSX) | 1049 #if defined(OS_MACOSX) |
1049 scoped_refptr<SandboxedDMGAnalyzer> dmg_analyzer_; | 1050 scoped_refptr<SandboxedDMGAnalyzer> dmg_analyzer_; |
1050 base::TimeTicks dmg_analysis_start_time_; | 1051 base::TimeTicks dmg_analysis_start_time_; |
1051 #endif | 1052 #endif |
1052 bool finished_; | 1053 bool finished_; |
1053 ClientDownloadRequest::DownloadType type_; | 1054 ClientDownloadRequest::DownloadType type_; |
1054 std::string client_download_request_data_; | 1055 std::string client_download_request_data_; |
1055 base::CancelableTaskTracker request_tracker_; // For HistoryService lookup. | 1056 base::CancelableTaskTracker request_tracker_; // For HistoryService lookup. |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 GURL DownloadProtectionService::GetDownloadRequestUrl() { | 1280 GURL DownloadProtectionService::GetDownloadRequestUrl() { |
1280 GURL url(kDownloadRequestUrl); | 1281 GURL url(kDownloadRequestUrl); |
1281 std::string api_key = google_apis::GetAPIKey(); | 1282 std::string api_key = google_apis::GetAPIKey(); |
1282 if (!api_key.empty()) | 1283 if (!api_key.empty()) |
1283 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); | 1284 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); |
1284 | 1285 |
1285 return url; | 1286 return url; |
1286 } | 1287 } |
1287 | 1288 |
1288 } // namespace safe_browsing | 1289 } // namespace safe_browsing |
OLD | NEW |