| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 void OnSafeBrowsingResult( | 194 void OnSafeBrowsingResult( |
| 195 LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck* check) { | 195 LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck* check) { |
| 196 check->OnSafeBrowsingResult(); | 196 check->OnSafeBrowsingResult(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 ACTION_P(CheckDownloadUrlDone, threat_type) { | 199 ACTION_P(CheckDownloadUrlDone, threat_type) { |
| 200 // TODO(nparker): Remove use of SafeBrowsingCheck and instead call | 200 // TODO(nparker): Remove use of SafeBrowsingCheck and instead call |
| 201 // client->OnCheckDownloadUrlResult(..) directly. | 201 // client->OnCheckDownloadUrlResult(..) directly. |
| 202 LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck* check = | 202 LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck* check = |
| 203 new LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck( | 203 new LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck( |
| 204 arg0, | 204 arg0, std::vector<SBFullHash>(), arg1, BINURL, |
| 205 std::vector<SBFullHash>(), | |
| 206 arg1, | |
| 207 safe_browsing::BINURL, | |
| 208 std::vector<SBThreatType>(1, SB_THREAT_TYPE_BINARY_MALWARE_URL)); | 205 std::vector<SBThreatType>(1, SB_THREAT_TYPE_BINARY_MALWARE_URL)); |
| 209 for (size_t i = 0; i < check->url_results.size(); ++i) | 206 for (size_t i = 0; i < check->url_results.size(); ++i) |
| 210 check->url_results[i] = threat_type; | 207 check->url_results[i] = threat_type; |
| 211 BrowserThread::PostTask(BrowserThread::IO, | 208 BrowserThread::PostTask(BrowserThread::IO, |
| 212 FROM_HERE, | 209 FROM_HERE, |
| 213 base::Bind(&OnSafeBrowsingResult, | 210 base::Bind(&OnSafeBrowsingResult, |
| 214 base::Owned(check))); | 211 base::Owned(check))); |
| 215 } | 212 } |
| 216 | 213 |
| 217 class DownloadProtectionServiceTest : public testing::Test { | 214 class DownloadProtectionServiceTest : public testing::Test { |
| (...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2031 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); | 2028 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); |
| 2032 #else | 2029 #else |
| 2033 // On !(OS_WIN || OS_MACOSX || OS_CHROMEOS), | 2030 // On !(OS_WIN || OS_MACOSX || OS_CHROMEOS), |
| 2034 // no file types are currently supported. Hence all | 2031 // no file types are currently supported. Hence all |
| 2035 // requests to CheckClientDownload() result in a verdict of UNKNOWN. | 2032 // requests to CheckClientDownload() result in a verdict of UNKNOWN. |
| 2036 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); | 2033 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); |
| 2037 #endif | 2034 #endif |
| 2038 } | 2035 } |
| 2039 | 2036 |
| 2040 } // namespace safe_browsing | 2037 } // namespace safe_browsing |
| OLD | NEW |