| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 RecordFileExtensionType(item_->GetTargetFilePath()); | 327 RecordFileExtensionType(item_->GetTargetFilePath()); |
| 328 | 328 |
| 329 // Compute features from the file contents. Note that we record histograms | 329 // Compute features from the file contents. Note that we record histograms |
| 330 // based on the result, so this runs regardless of whether the pingbacks | 330 // based on the result, so this runs regardless of whether the pingbacks |
| 331 // are enabled. | 331 // are enabled. |
| 332 if (item_->GetTargetFilePath().MatchesExtension( | 332 if (item_->GetTargetFilePath().MatchesExtension( |
| 333 FILE_PATH_LITERAL(".zip"))) { | 333 FILE_PATH_LITERAL(".zip"))) { |
| 334 StartExtractZipFeatures(); | 334 StartExtractZipFeatures(); |
| 335 #if defined(OS_MACOSX) | 335 #if defined(OS_MACOSX) |
| 336 } else if (item_->GetTargetFilePath().MatchesExtension( | 336 } else if (item_->GetTargetFilePath().MatchesExtension( |
| 337 FILE_PATH_LITERAL(".dmg"))) { | 337 FILE_PATH_LITERAL(".dmg")) || |
| 338 item_->GetTargetFilePath().MatchesExtension( |
| 339 FILE_PATH_LITERAL(".img")) || |
| 340 item_->GetTargetFilePath().MatchesExtension( |
| 341 FILE_PATH_LITERAL(".iso")) || |
| 342 item_->GetTargetFilePath().MatchesExtension( |
| 343 FILE_PATH_LITERAL(".smi")) || |
| 344 item_->GetTargetFilePath().MatchesExtension( |
| 345 FILE_PATH_LITERAL(".cdr")) || |
| 346 item_->GetTargetFilePath().MatchesExtension( |
| 347 FILE_PATH_LITERAL(".dart")) || |
| 348 item_->GetTargetFilePath().MatchesExtension( |
| 349 FILE_PATH_LITERAL(".dc42")) || |
| 350 item_->GetTargetFilePath().MatchesExtension( |
| 351 FILE_PATH_LITERAL(".diskcopy42")) || |
| 352 item_->GetTargetFilePath().MatchesExtension( |
| 353 FILE_PATH_LITERAL(".dmgpart")) || |
| 354 item_->GetTargetFilePath().MatchesExtension( |
| 355 FILE_PATH_LITERAL(".dvdr")) || |
| 356 item_->GetTargetFilePath().MatchesExtension( |
| 357 FILE_PATH_LITERAL(".imgpart")) || |
| 358 item_->GetTargetFilePath().MatchesExtension( |
| 359 FILE_PATH_LITERAL(".ndif")) || |
| 360 item_->GetTargetFilePath().MatchesExtension( |
| 361 FILE_PATH_LITERAL(".sparsebundle")) || |
| 362 item_->GetTargetFilePath().MatchesExtension( |
| 363 FILE_PATH_LITERAL(".sparseimage")) || |
| 364 item_->GetTargetFilePath().MatchesExtension( |
| 365 FILE_PATH_LITERAL(".toast")) || |
| 366 item_->GetTargetFilePath().MatchesExtension( |
| 367 FILE_PATH_LITERAL(".udif"))) { |
| 338 StartExtractDmgFeatures(); | 368 StartExtractDmgFeatures(); |
| 339 #endif | 369 #endif |
| 340 } else { | 370 } else { |
| 341 StartExtractFileFeatures(); | 371 StartExtractFileFeatures(); |
| 342 } | 372 } |
| 343 } | 373 } |
| 344 | 374 |
| 345 // Start a timeout to cancel the request if it takes too long. | 375 // Start a timeout to cancel the request if it takes too long. |
| 346 // This should only be called after we have finished accessing the file. | 376 // This should only be called after we have finished accessing the file. |
| 347 void StartTimeout() { | 377 void StartTimeout() { |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 GURL DownloadProtectionService::GetDownloadRequestUrl() { | 1283 GURL DownloadProtectionService::GetDownloadRequestUrl() { |
| 1254 GURL url(kDownloadRequestUrl); | 1284 GURL url(kDownloadRequestUrl); |
| 1255 std::string api_key = google_apis::GetAPIKey(); | 1285 std::string api_key = google_apis::GetAPIKey(); |
| 1256 if (!api_key.empty()) | 1286 if (!api_key.empty()) |
| 1257 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); | 1287 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); |
| 1258 | 1288 |
| 1259 return url; | 1289 return url; |
| 1260 } | 1290 } |
| 1261 | 1291 |
| 1262 } // namespace safe_browsing | 1292 } // namespace safe_browsing |
| OLD | NEW |