OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // so that the animation ends faded out. | 46 // so that the animation ends faded out. |
47 static const int kCompleteAnimationCycles = 5; | 47 static const int kCompleteAnimationCycles = 5; |
48 | 48 |
49 // Download opening ------------------------------------------------------------ | 49 // Download opening ------------------------------------------------------------ |
50 | 50 |
51 bool CanOpenDownload(DownloadItem* download) { | 51 bool CanOpenDownload(DownloadItem* download) { |
52 FilePath file_to_use = download->full_path(); | 52 FilePath file_to_use = download->full_path(); |
53 if (!download->original_name().value().empty()) | 53 if (!download->original_name().value().empty()) |
54 file_to_use = download->original_name(); | 54 file_to_use = download->original_name(); |
55 | 55 |
56 return !download->manager()->IsExecutableFile(file_to_use); | 56 const FilePath::StringType extension = |
| 57 file_util::GetFileExtensionFromPath(file_to_use); |
| 58 return !download->manager()->IsExecutable(extension); |
57 } | 59 } |
58 | 60 |
59 void OpenDownload(DownloadItem* download) { | 61 void OpenDownload(DownloadItem* download) { |
60 if (download->state() == DownloadItem::IN_PROGRESS) { | 62 if (download->state() == DownloadItem::IN_PROGRESS) { |
61 download->set_open_when_complete(!download->open_when_complete()); | 63 download->set_open_when_complete(!download->open_when_complete()); |
62 } else if (download->state() == DownloadItem::COMPLETE) { | 64 } else if (download->state() == DownloadItem::COMPLETE) { |
63 download->NotifyObserversDownloadOpened(); | 65 download->NotifyObserversDownloadOpened(); |
64 download->manager()->OpenDownload(download, NULL); | 66 download->manager()->OpenDownload(download, NULL); |
65 } | 67 } |
66 } | 68 } |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 289 } |
288 #elif defined(OS_LINUX) | 290 #elif defined(OS_LINUX) |
289 void DragDownload(const DownloadItem* download, | 291 void DragDownload(const DownloadItem* download, |
290 SkBitmap* icon, | 292 SkBitmap* icon, |
291 gfx::NativeView view) { | 293 gfx::NativeView view) { |
292 NOTIMPLEMENTED(); | 294 NOTIMPLEMENTED(); |
293 } | 295 } |
294 #endif // OS_LINUX | 296 #endif // OS_LINUX |
295 | 297 |
296 } // namespace download_util | 298 } // namespace download_util |
OLD | NEW |