| 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   const FilePath::StringType extension = | 56   return !download->manager()->IsExecutableFile(file_to_use); | 
| 57       file_util::GetFileExtensionFromPath(file_to_use); |  | 
| 58   return !download->manager()->IsExecutable(extension); |  | 
| 59 } | 57 } | 
| 60 | 58 | 
| 61 void OpenDownload(DownloadItem* download) { | 59 void OpenDownload(DownloadItem* download) { | 
| 62   if (download->state() == DownloadItem::IN_PROGRESS) { | 60   if (download->state() == DownloadItem::IN_PROGRESS) { | 
| 63     download->set_open_when_complete(!download->open_when_complete()); | 61     download->set_open_when_complete(!download->open_when_complete()); | 
| 64   } else if (download->state() == DownloadItem::COMPLETE) { | 62   } else if (download->state() == DownloadItem::COMPLETE) { | 
| 65     download->NotifyObserversDownloadOpened(); | 63     download->NotifyObserversDownloadOpened(); | 
| 66     download->manager()->OpenDownload(download, NULL); | 64     download->manager()->OpenDownload(download, NULL); | 
| 67   } | 65   } | 
| 68 } | 66 } | 
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 289 } | 287 } | 
| 290 #elif defined(OS_LINUX) | 288 #elif defined(OS_LINUX) | 
| 291 void DragDownload(const DownloadItem* download, | 289 void DragDownload(const DownloadItem* download, | 
| 292                   SkBitmap* icon, | 290                   SkBitmap* icon, | 
| 293                   gfx::NativeView view) { | 291                   gfx::NativeView view) { | 
| 294   NOTIMPLEMENTED(); | 292   NOTIMPLEMENTED(); | 
| 295 } | 293 } | 
| 296 #endif  // OS_LINUX | 294 #endif  // OS_LINUX | 
| 297 | 295 | 
| 298 }  // namespace download_util | 296 }  // namespace download_util | 
| OLD | NEW | 
|---|