| 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 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 } | 1225 } |
| 1226 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { | 1226 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { |
| 1227 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) | 1227 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) |
| 1228 return false; | 1228 return false; |
| 1229 } | 1229 } |
| 1230 // We consider only other application types to be executable. | 1230 // We consider only other application types to be executable. |
| 1231 return net::MatchesMimeType("application/*", mime_type); | 1231 return net::MatchesMimeType("application/*", mime_type); |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 bool DownloadManager::IsExecutable(const FilePath::StringType& extension) { | 1234 bool DownloadManager::IsExecutable(const FilePath::StringType& extension) { |
| 1235 return exe_types_.find(extension) != exe_types_.end(); | 1235 #if defined(OS_WIN) |
| 1236 if (!IsStringASCII(extension)) |
| 1237 return false; |
| 1238 std::string ascii_extension = WideToASCII(extension); |
| 1239 StringToLowerASCII(&ascii_extension); |
| 1240 |
| 1241 return exe_types_.find(ascii_extension) != exe_types_.end(); |
| 1242 #elif defined(OS_POSIX) |
| 1243 // TODO(port): we misght not want to call this function on other platforms. |
| 1244 // Figure it out. |
| 1245 NOTIMPLEMENTED(); |
| 1246 return false; |
| 1247 #endif |
| 1236 } | 1248 } |
| 1237 | 1249 |
| 1238 void DownloadManager::ResetAutoOpenFiles() { | 1250 void DownloadManager::ResetAutoOpenFiles() { |
| 1239 auto_open_.clear(); | 1251 auto_open_.clear(); |
| 1240 SaveAutoOpens(); | 1252 SaveAutoOpens(); |
| 1241 } | 1253 } |
| 1242 | 1254 |
| 1243 bool DownloadManager::HasAutoOpenFileTypesRegistered() const { | 1255 bool DownloadManager::HasAutoOpenFileTypesRegistered() const { |
| 1244 return !auto_open_.empty(); | 1256 return !auto_open_.empty(); |
| 1245 } | 1257 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 searched_downloads.push_back(dit->second); | 1431 searched_downloads.push_back(dit->second); |
| 1420 } | 1432 } |
| 1421 | 1433 |
| 1422 requestor->SetDownloads(searched_downloads); | 1434 requestor->SetDownloads(searched_downloads); |
| 1423 } | 1435 } |
| 1424 | 1436 |
| 1425 // Clears the last download path, used to initialize "save as" dialogs. | 1437 // Clears the last download path, used to initialize "save as" dialogs. |
| 1426 void DownloadManager::ClearLastDownloadPath() { | 1438 void DownloadManager::ClearLastDownloadPath() { |
| 1427 last_download_path_ = FilePath(); | 1439 last_download_path_ = FilePath(); |
| 1428 } | 1440 } |
| OLD | NEW |