OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/download/download_manager.h" | 5 #include "chrome/browser/download/download_manager.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 } | 1233 } |
1234 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { | 1234 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { |
1235 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) | 1235 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) |
1236 return false; | 1236 return false; |
1237 } | 1237 } |
1238 // We consider only other application types to be executable. | 1238 // We consider only other application types to be executable. |
1239 return net::MatchesMimeType("application/*", mime_type); | 1239 return net::MatchesMimeType("application/*", mime_type); |
1240 } | 1240 } |
1241 | 1241 |
1242 bool DownloadManager::IsExecutable(const FilePath::StringType& extension) { | 1242 bool DownloadManager::IsExecutable(const FilePath::StringType& extension) { |
1243 return exe_types_.find(extension) != exe_types_.end(); | 1243 #if defined(OS_WIN) |
| 1244 if (!IsStringASCII(extension)) |
| 1245 return false; |
| 1246 std::string ascii_extension = WideToASCII(extension); |
| 1247 StringToLowerASCII(&ascii_extension); |
| 1248 |
| 1249 return exe_types_.find(ascii_extension) != exe_types_.end(); |
| 1250 #else if defined(OS_POSIX) |
| 1251 // TODO(port): we might not want to call this function on other platforms. |
| 1252 // Figure it out. |
| 1253 NOTIMPLEMENTED(); |
| 1254 return false; |
| 1255 #endif |
1244 } | 1256 } |
1245 | 1257 |
1246 void DownloadManager::ResetAutoOpenFiles() { | 1258 void DownloadManager::ResetAutoOpenFiles() { |
1247 auto_open_.clear(); | 1259 auto_open_.clear(); |
1248 SaveAutoOpens(); | 1260 SaveAutoOpens(); |
1249 } | 1261 } |
1250 | 1262 |
1251 bool DownloadManager::HasAutoOpenFileTypesRegistered() const { | 1263 bool DownloadManager::HasAutoOpenFileTypesRegistered() const { |
1252 return !auto_open_.empty(); | 1264 return !auto_open_.empty(); |
1253 } | 1265 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 searched_downloads.push_back(dit->second); | 1437 searched_downloads.push_back(dit->second); |
1426 } | 1438 } |
1427 | 1439 |
1428 requestor->SetDownloads(searched_downloads); | 1440 requestor->SetDownloads(searched_downloads); |
1429 } | 1441 } |
1430 | 1442 |
1431 // Clears the last download path, used to initialize "save as" dialogs. | 1443 // Clears the last download path, used to initialize "save as" dialogs. |
1432 void DownloadManager::ClearLastDownloadPath() { | 1444 void DownloadManager::ClearLastDownloadPath() { |
1433 last_download_path_ = FilePath(); | 1445 last_download_path_ = FilePath(); |
1434 } | 1446 } |
OLD | NEW |