summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 20:29:40 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 20:29:40 +0000
commitde86a8510c9c8f70f27ce41b425a82c416f987e2 (patch)
treeb1442d4b7bd4a856c1389c908f7fd9298ec81270 /chrome/browser/download
parentfc7c36a2c51aeba1da2495ffa5f6944179b93974 (diff)
downloadchromium_src-de86a8510c9c8f70f27ce41b425a82c416f987e2.zip
chromium_src-de86a8510c9c8f70f27ce41b425a82c416f987e2.tar.gz
chromium_src-de86a8510c9c8f70f27ce41b425a82c416f987e2.tar.bz2
Linux: call xdg-open on downloaded files to open them.
BUG=12299 TEST=1) right click/save as on some image. Clicking on the download item's filename area should launch it in some image viewer (assuming xdg-open works for you---as it happens, ubuntu broke xdg-open for desktops that are not gnome, kde, or xfce). 2) Download a large file. Click on the download item before it is finished. The text should change to "opening in..." and the checkbox in the dropdown menu should show as checked. 3) completed downloads should have the "open when finished" menu item replaced by the "open" menu item. Selecting that should also open the download. Review URL: http://codereview.chromium.org/112064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r--chrome/browser/download/download_file.cc17
-rw-r--r--chrome/browser/download/download_shelf.cc15
2 files changed, 13 insertions, 19 deletions
diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc
index 069fc58..b871540 100644
--- a/chrome/browser/download/download_file.cc
+++ b/chrome/browser/download/download_file.cc
@@ -530,24 +530,23 @@ void DownloadFileManager::OnShowDownloadInShell(const FilePath& full_path) {
platform_util::ShowItemInFolder(full_path);
}
-// Launches the selected download using ShellExecute 'open' verb. If there is
-// a valid parent window, the 'safer' version will be used which can
+// Launches the selected download using ShellExecute 'open' verb. For windows,
+// if there is a valid parent window, the 'safer' version will be used which can
// display a modal dialog asking for user consent on dangerous files.
void DownloadFileManager::OnOpenDownloadInShell(const FilePath& full_path,
const GURL& url,
gfx::NativeView parent_window) {
-#if defined(OS_WIN)
DCHECK(MessageLoop::current() == file_loop_);
+
+#if defined(OS_WIN)
if (NULL != parent_window) {
win_util::SaferOpenItemViaShell(parent_window, L"", full_path,
- UTF8ToWide(url.spec()), true);
- } else {
- win_util::OpenItemViaShell(full_path, true);
+ UTF8ToWide(url.spec()));
+ return;
}
-#else
- // TODO(port) implement me.
- NOTREACHED();
#endif
+
+ platform_util::OpenItem(full_path);
}
// The DownloadManager in the UI thread has provided a final name for the
diff --git a/chrome/browser/download/download_shelf.cc b/chrome/browser/download/download_shelf.cc
index b71caee..6962a3e 100644
--- a/chrome/browser/download/download_shelf.cc
+++ b/chrome/browser/download/download_shelf.cc
@@ -14,10 +14,9 @@
#include "chrome/common/url_constants.h"
#include "grit/generated_resources.h"
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_LINUX)
+// TODO(port): port this for mac. See two uses below.
#include "chrome/browser/download/download_util.h"
-#elif defined(OS_POSIX)
-#include "chrome/common/temp_scaffolding_stubs.h"
#endif
// DownloadShelf ---------------------------------------------------------------
@@ -88,10 +87,9 @@ bool DownloadShelfContextMenu::IsItemCommandEnabled(int id) const {
case OPEN_WHEN_COMPLETE:
return download_->state() != DownloadItem::CANCELLED;
case ALWAYS_OPEN_TYPE:
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_LINUX)
return download_util::CanOpenDownload(download_);
-#elif defined(OS_LINUX)
- // Need to implement dangerous download stuff: http://crbug.com/11780
+#else
return false;
#endif
case CANCEL:
@@ -107,11 +105,8 @@ void DownloadShelfContextMenu::ExecuteItemCommand(int id) {
download_->manager()->ShowDownloadInShell(download_);
break;
case OPEN_WHEN_COMPLETE:
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_LINUX)
download_util::OpenDownload(download_);
-#else
- // TODO(port): port download_util
- NOTIMPLEMENTED();
#endif
break;
case ALWAYS_OPEN_TYPE: {