| 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 // Download utility implementation | 5 // Download utility implementation |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "chrome/browser/download/download_util.h" | 9 #include "chrome/browser/download/download_util.h" |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 const FilePath::StringType extension = | 45 const FilePath::StringType extension = |
| 46 file_util::GetFileExtensionFromPath(file_to_use); | 46 file_util::GetFileExtensionFromPath(file_to_use); |
| 47 return !download->manager()->IsExecutable(extension); | 47 return !download->manager()->IsExecutable(extension); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void OpenDownload(DownloadItem* download) { | 50 void OpenDownload(DownloadItem* download) { |
| 51 if (download->state() == DownloadItem::IN_PROGRESS) | 51 if (download->state() == DownloadItem::IN_PROGRESS) |
| 52 download->set_open_when_complete(!download->open_when_complete()); | 52 download->set_open_when_complete(!download->open_when_complete()); |
| 53 else if (download->state() == DownloadItem::COMPLETE) | 53 else if (download->state() == DownloadItem::COMPLETE) |
| 54 download->manager()->OpenDownloadInShell(download, NULL); | 54 download->manager()->OpenDownload(download, NULL); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Download progress painting -------------------------------------------------- | 57 // Download progress painting -------------------------------------------------- |
| 58 | 58 |
| 59 // Common bitmaps used for download progress animations. We load them once the | 59 // Common bitmaps used for download progress animations. We load them once the |
| 60 // first time we do a progress paint, then reuse them as they are always the | 60 // first time we do a progress paint, then reuse them as they are always the |
| 61 // same. | 61 // same. |
| 62 SkBitmap* g_foreground_16 = NULL; | 62 SkBitmap* g_foreground_16 = NULL; |
| 63 SkBitmap* g_background_16 = NULL; | 63 SkBitmap* g_background_16 = NULL; |
| 64 SkBitmap* g_foreground_32 = NULL; | 64 SkBitmap* g_foreground_32 = NULL; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 data->SetFilename(download->full_path().ToWStringHack()); | 238 data->SetFilename(download->full_path().ToWStringHack()); |
| 239 scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); | 239 scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); |
| 240 | 240 |
| 241 // Run the drag and drop loop | 241 // Run the drag and drop loop |
| 242 DWORD effects; | 242 DWORD effects; |
| 243 DoDragDrop(data.get(), drag_source.get(), DROPEFFECT_COPY | DROPEFFECT_LINK, | 243 DoDragDrop(data.get(), drag_source.get(), DROPEFFECT_COPY | DROPEFFECT_LINK, |
| 244 &effects); | 244 &effects); |
| 245 } | 245 } |
| 246 | 246 |
| 247 } // namespace download_util | 247 } // namespace download_util |
| OLD | NEW |