summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/download/download_file.cc17
-rw-r--r--chrome/browser/download/download_shelf.cc15
-rw-r--r--chrome/browser/gtk/download_item_gtk.cc15
-rw-r--r--chrome/browser/gtk/download_item_gtk.h3
4 files changed, 31 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: {
diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/gtk/download_item_gtk.cc
index 580db74..6b1ff4e 100644
--- a/chrome/browser/gtk/download_item_gtk.cc
+++ b/chrome/browser/gtk/download_item_gtk.cc
@@ -181,6 +181,8 @@ DownloadItemGtk::DownloadItemGtk(DownloadShelfGtk* parent_shelf,
gtk_widget_set_app_paintable(body_, TRUE);
g_signal_connect(body_, "expose-event",
G_CALLBACK(OnExpose), this);
+ g_signal_connect(body_, "clicked",
+ G_CALLBACK(OnClick), this);
GTK_WIDGET_UNSET_FLAGS(body_, GTK_CAN_FOCUS);
// Remove internal padding on the button.
GtkRcStyle* no_padding_style = gtk_rc_style_new();
@@ -565,6 +567,19 @@ gboolean DownloadItemGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e,
}
// static
+void DownloadItemGtk::OnClick(GtkWidget* widget, DownloadItemGtk* item) {
+ DownloadItem* download = item->get_download();
+
+ // TODO(estade): add clickjacking histogram stuff.
+ if (download->state() == DownloadItem::IN_PROGRESS) {
+ download->set_open_when_complete(
+ !download->open_when_complete());
+ } else if (download->state() == DownloadItem::COMPLETE) {
+ download_util::OpenDownload(download);
+ }
+}
+
+// static
gboolean DownloadItemGtk::OnProgressAreaExpose(GtkWidget* widget,
GdkEventExpose* event, DownloadItemGtk* download_item) {
// Create a transparent canvas.
diff --git a/chrome/browser/gtk/download_item_gtk.h b/chrome/browser/gtk/download_item_gtk.h
index fba3a8a..c9b1ae0 100644
--- a/chrome/browser/gtk/download_item_gtk.h
+++ b/chrome/browser/gtk/download_item_gtk.h
@@ -68,6 +68,9 @@ class DownloadItemGtk : public DownloadItem::Observer,
static gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e,
DownloadItemGtk* download_item);
+ // Called when |body_| is clicked.
+ static void OnClick(GtkWidget* widget, DownloadItemGtk* item);
+
// Used for the download icon.
static gboolean OnProgressAreaExpose(GtkWidget* widget,
GdkEventExpose* e,