summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_manager.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-12 23:36:30 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-12 23:36:30 +0000
commit0f44d3e778979b6f1acae43a39e4b4bf9d557c8b (patch)
tree8f37c45a6e7de25156fbaa7516373920d96a8500 /chrome/browser/download/download_manager.cc
parentbd1d148d3f4888f715c2c9995d78b9294c35084b (diff)
downloadchromium_src-0f44d3e778979b6f1acae43a39e4b4bf9d557c8b.zip
chromium_src-0f44d3e778979b6f1acae43a39e4b4bf9d557c8b.tar.gz
chromium_src-0f44d3e778979b6f1acae43a39e4b4bf9d557c8b.tar.bz2
Gtk dialogs, first cut.
Only the Save As file selection dialog is implemented for now. Review URL: http://codereview.chromium.org/42152 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11594 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_manager.cc')
-rw-r--r--chrome/browser/download/download_manager.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 719efa0..98b0e32 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -45,6 +45,10 @@
#include "chrome/common/win_util.h"
#endif
+#if defined(OS_LINUX)
+#include <gtk/gtk.h>
+#endif
+
// Periodically update our observers.
class DownloadItemUpdateTask : public Task {
public:
@@ -618,7 +622,7 @@ void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info) {
}
void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) {
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_LINUX)
DCHECK(MessageLoop::current() == ui_loop_);
DCHECK(info);
@@ -629,20 +633,27 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) {
WebContents* contents = tab_util::GetWebContentsByID(
info->render_process_id, info->render_view_id);
+#if defined(OS_WIN)
std::wstring filter =
win_util::GetFileFilterFromPath(info->suggested_path.value());
- HWND owning_hwnd =
+ gfx::NativeWindow owning_window =
contents ? GetAncestor(contents->GetNativeView(), GA_ROOT) : NULL;
+#elif defined(OS_LINUX)
+ std::wstring filter;
+ gfx::NativeWindow owning_window = contents ?
+ GTK_WINDOW(gtk_widget_get_toplevel(contents->GetNativeView())) :
+ NULL;
+#endif
select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE,
std::wstring(),
info->suggested_path.ToWStringHack(),
filter, std::wstring(),
- owning_hwnd, info);
+ owning_window, info);
} else {
// No prompting for download, just continue with the suggested name.
ContinueStartDownload(info, info->suggested_path);
}
-#elif defined(OS_POSIX)
+#elif defined(OS_MACOSX)
// TODO(port): port this file -- need dialogs.
NOTIMPLEMENTED();
#endif