OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/incident_reporting/last_download_finder.h
" | 5 #include "chrome/browser/safe_browsing/incident_reporting/last_download_finder.h
" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 // Returns the end time of a download represented by a DownloadDetails. | 45 // Returns the end time of a download represented by a DownloadDetails. |
46 int64 GetEndTime(const ClientIncidentReport_DownloadDetails& details) { | 46 int64 GetEndTime(const ClientIncidentReport_DownloadDetails& details) { |
47 return details.download_time_msec(); | 47 return details.download_time_msec(); |
48 } | 48 } |
49 | 49 |
50 bool IsBinaryDownloadForCurrentOS( | 50 bool IsBinaryDownloadForCurrentOS( |
51 ClientDownloadRequest::DownloadType download_type) { | 51 ClientDownloadRequest::DownloadType download_type) { |
52 static_assert(ClientDownloadRequest::DownloadType_MAX == | 52 static_assert(ClientDownloadRequest::DownloadType_MAX == |
53 ClientDownloadRequest::ARCHIVE, | 53 ClientDownloadRequest::INVALID_MAC_ARCHIVE, |
54 "Update logic below"); | 54 "Update logic below"); |
55 | 55 |
56 // Platform-specific types are relevant only for their own platforms. | 56 // Platform-specific types are relevant only for their own platforms. |
57 #if defined(OS_MACOSX) | 57 #if defined(OS_MACOSX) |
58 if (download_type == ClientDownloadRequest::MAC_EXECUTABLE) | 58 if (download_type == ClientDownloadRequest::MAC_EXECUTABLE || |
| 59 download_type == ClientDownloadRequest::INVALID_MAC_ARCHIVE) |
59 return true; | 60 return true; |
60 #elif defined(OS_ANDROID) | 61 #elif defined(OS_ANDROID) |
61 if (download_type == ClientDownloadRequest::ANDROID_APK) | 62 if (download_type == ClientDownloadRequest::ANDROID_APK) |
62 return true; | 63 return true; |
63 #endif | 64 #endif |
64 | 65 |
65 // Extensions are supported where enabled. | 66 // Extensions are supported where enabled. |
66 #if defined(ENABLE_EXTENSIONS) | 67 #if defined(ENABLE_EXTENSIONS) |
67 if (download_type == ClientDownloadRequest::CHROME_EXTENSION) | 68 if (download_type == ClientDownloadRequest::CHROME_EXTENSION) |
68 return true; | 69 return true; |
69 #endif | 70 #endif |
70 | 71 |
71 if (download_type == ClientDownloadRequest::ZIPPED_EXECUTABLE || | 72 if (download_type == ClientDownloadRequest::ZIPPED_EXECUTABLE || |
72 download_type == ClientDownloadRequest::ZIPPED_ARCHIVE || | 73 download_type == ClientDownloadRequest::ZIPPED_ARCHIVE || |
| 74 download_type == ClientDownloadRequest::INVALID_ZIP || |
73 download_type == ClientDownloadRequest::ARCHIVE) { | 75 download_type == ClientDownloadRequest::ARCHIVE) { |
74 return true; | 76 return true; |
75 } | 77 } |
76 | 78 |
77 // The default return value of download_protection_util::GetDownloadType is | 79 // The default return value of download_protection_util::GetDownloadType is |
78 // ClientDownloadRequest::WIN_EXECUTABLE. | 80 // ClientDownloadRequest::WIN_EXECUTABLE. |
79 return download_type == ClientDownloadRequest::WIN_EXECUTABLE; | 81 return download_type == ClientDownloadRequest::WIN_EXECUTABLE; |
80 } | 82 } |
81 | 83 |
82 // Returns true if a download represented by a DownloadRow is a binary file for | 84 // Returns true if a download represented by a DownloadRow is a binary file for |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 } | 432 } |
431 } | 433 } |
432 } | 434 } |
433 | 435 |
434 void LastDownloadFinder::HistoryServiceBeingDeleted( | 436 void LastDownloadFinder::HistoryServiceBeingDeleted( |
435 history::HistoryService* history_service) { | 437 history::HistoryService* history_service) { |
436 history_service_observer_.Remove(history_service); | 438 history_service_observer_.Remove(history_service); |
437 } | 439 } |
438 | 440 |
439 } // namespace safe_browsing | 441 } // namespace safe_browsing |
OLD | NEW |