| 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/common/safe_browsing/download_protection_util.h" | 5 #include "chrome/common/safe_browsing/download_protection_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "build/build_config.h" |
| 12 #include "chrome/common/safe_browsing/file_type_policies.h" | 13 #include "chrome/common/safe_browsing/file_type_policies.h" |
| 13 | 14 |
| 14 namespace safe_browsing { | 15 namespace safe_browsing { |
| 15 namespace download_protection_util { | 16 namespace download_protection_util { |
| 16 | 17 |
| 17 ClientDownloadRequest::DownloadType GetDownloadType( | 18 ClientDownloadRequest::DownloadType GetDownloadType( |
| 18 const base::FilePath& file) { | 19 const base::FilePath& file) { |
| 19 // TODO(nparker): Put all of this logic into the FileTypePolicies | 20 // TODO(nparker): Put all of this logic into the FileTypePolicies |
| 20 // protobuf. | 21 // protobuf. |
| 21 if (file.MatchesExtension(FILE_PATH_LITERAL(".apk"))) | 22 if (file.MatchesExtension(FILE_PATH_LITERAL(".apk"))) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 45 file.MatchesExtension(FILE_PATH_LITERAL(".diskcopy42")) || | 46 file.MatchesExtension(FILE_PATH_LITERAL(".diskcopy42")) || |
| 46 file.MatchesExtension(FILE_PATH_LITERAL(".imgpart")) || | 47 file.MatchesExtension(FILE_PATH_LITERAL(".imgpart")) || |
| 47 file.MatchesExtension(FILE_PATH_LITERAL(".ndif")) || | 48 file.MatchesExtension(FILE_PATH_LITERAL(".ndif")) || |
| 48 file.MatchesExtension(FILE_PATH_LITERAL(".udif")) || | 49 file.MatchesExtension(FILE_PATH_LITERAL(".udif")) || |
| 49 file.MatchesExtension(FILE_PATH_LITERAL(".toast")) || | 50 file.MatchesExtension(FILE_PATH_LITERAL(".toast")) || |
| 50 file.MatchesExtension(FILE_PATH_LITERAL(".sparsebundle")) || | 51 file.MatchesExtension(FILE_PATH_LITERAL(".sparsebundle")) || |
| 51 file.MatchesExtension(FILE_PATH_LITERAL(".sparseimage"))) | 52 file.MatchesExtension(FILE_PATH_LITERAL(".sparseimage"))) |
| 52 return ClientDownloadRequest::MAC_EXECUTABLE; | 53 return ClientDownloadRequest::MAC_EXECUTABLE; |
| 53 else if (FileTypePolicies::GetInstance()->IsArchiveFile(file)) | 54 else if (FileTypePolicies::GetInstance()->IsArchiveFile(file)) |
| 54 return ClientDownloadRequest::ARCHIVE; | 55 return ClientDownloadRequest::ARCHIVE; |
| 56 #if defined(OS_MACOSX) |
| 57 return ClientDownloadRequest::MAC_EXECUTABLE; |
| 58 #else |
| 55 return ClientDownloadRequest::WIN_EXECUTABLE; | 59 return ClientDownloadRequest::WIN_EXECUTABLE; |
| 60 #endif // OS_MACOSX |
| 56 } | 61 } |
| 57 | 62 |
| 58 } // namespace download_protection_util | 63 } // namespace download_protection_util |
| 59 } // namespace safe_browsing | 64 } // namespace safe_browsing |
| OLD | NEW |