| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Download utility implementation | 5 // Download utility implementation |
| 6 | 6 |
| 7 #include "chrome/browser/download/download_util.h" | 7 #include "chrome/browser/download/download_util.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <shobjidl.h> | 10 #include <shobjidl.h> |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 for (int i = 0; i < arraysize(integrated_extensions); ++i) { | 108 for (int i = 0; i < arraysize(integrated_extensions); ++i) { |
| 109 if (extension_lower == integrated_extensions[i]) | 109 if (extension_lower == integrated_extensions[i]) |
| 110 return true; | 110 return true; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // See <http://www.juniper.net/security/auto/vulnerabilities/vuln2612.html>. | 113 // See <http://www.juniper.net/security/auto/vulnerabilities/vuln2612.html>. |
| 114 // That vulnerability report is not exactly on point, but files become magical | 114 // That vulnerability report is not exactly on point, but files become magical |
| 115 // if their end in a CLSID. Here we block extensions that look like CLSIDs. | 115 // if their end in a CLSID. Here we block extensions that look like CLSIDs. |
| 116 if (extension_lower.size() > 0 && extension_lower.at(0) == L'{' && | 116 if (!extension_lower.empty() && extension_lower[0] == L'{' && |
| 117 extension_lower.at(extension_lower.length() - 1) == L'}') | 117 extension_lower[extension_lower.length() - 1] == L'}') |
| 118 return true; | 118 return true; |
| 119 | 119 |
| 120 return false; | 120 return false; |
| 121 } | 121 } |
| 122 | 122 |
| 123 // Returns whether the specified file name is a reserved name on windows. | 123 // Returns whether the specified file name is a reserved name on windows. |
| 124 // This includes names like "com2.zip" (which correspond to devices) and | 124 // This includes names like "com2.zip" (which correspond to devices) and |
| 125 // desktop.ini and thumbs.db which have special meaning to the windows shell. | 125 // desktop.ini and thumbs.db which have special meaning to the windows shell. |
| 126 bool IsReservedName(const string16& filename) { | 126 bool IsReservedName(const string16& filename) { |
| 127 // This list is taken from the MSDN article "Naming a file" | 127 // This list is taken from the MSDN article "Naming a file" |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 !service->IsDownloadFromGallery(info->url, info->referrer_url)) { | 832 !service->IsDownloadFromGallery(info->url, info->referrer_url)) { |
| 833 // Extensions that are not from the gallery are considered dangerous. | 833 // Extensions that are not from the gallery are considered dangerous. |
| 834 ret = true; | 834 ret = true; |
| 835 } | 835 } |
| 836 } | 836 } |
| 837 | 837 |
| 838 return ret; | 838 return ret; |
| 839 } | 839 } |
| 840 | 840 |
| 841 } // namespace download_util | 841 } // namespace download_util |
| OLD | NEW |