diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 23:36:30 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 23:36:30 +0000 |
commit | 0f44d3e778979b6f1acae43a39e4b4bf9d557c8b (patch) | |
tree | 8f37c45a6e7de25156fbaa7516373920d96a8500 /chrome/browser/download | |
parent | bd1d148d3f4888f715c2c9995d78b9294c35084b (diff) | |
download | chromium_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')
-rw-r--r-- | chrome/browser/download/download_manager.cc | 19 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.h | 4 |
2 files changed, 17 insertions, 6 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 diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index de1f3ab..4a3125b 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -53,10 +53,10 @@ #include "chrome/browser/history/history.h" #include "chrome/common/pref_member.h" -#if defined(OS_WIN) +#if defined(OS_WIN) || defined(OS_LINUX) // TODO(port): port this header. #include "chrome/browser/shell_dialogs.h" -#elif defined(OS_POSIX) +#elif defined(OS_MACOSX) #include "chrome/common/temp_scaffolding_stubs.h" #endif |