From 53c6d51d5604027fe01acb19a9e737f55fb58498 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 24 Sep 2013 10:13:43 +0800 Subject: [PATCH] win: Accept parent window in ShowOpenDialog. --- browser/ui/file_dialog_win.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/browser/ui/file_dialog_win.cc b/browser/ui/file_dialog_win.cc index b5c6d1aad4ca..043386cc21ad 100644 --- a/browser/ui/file_dialog_win.cc +++ b/browser/ui/file_dialog_win.cc @@ -162,7 +162,8 @@ class FileDialog { SetDefaultFolder(default_path); } - bool Show(HWND window) { + bool Show(atom::NativeWindow* parent_window) { + HWND window = parent_window ? parent_window->GetNativeWindow() : NULL; return dialog_->DoModal(window) == IDOK; } @@ -198,7 +199,8 @@ class FileDialog { } // namespace -bool ShowOpenDialog(const std::string& title, +bool ShowOpenDialog(atom::NativeWindow* parent_window, + const std::string& title, const base::FilePath& default_path, int properties, std::vector* paths) { @@ -214,7 +216,7 @@ bool ShowOpenDialog(const std::string& title, options, std::vector(), std::vector()); - if (!open_dialog.Show(::GetActiveWindow())) + if (!open_dialog.Show(parent_window)) return false; ATL::CComPtr items; @@ -247,7 +249,7 @@ bool ShowOpenDialog(const std::string& title, return true; } -bool ShowSaveDialog(atom::NativeWindow* window, +bool ShowSaveDialog(atom::NativeWindow* parent_window, const std::string& title, const base::FilePath& default_path, base::FilePath* path) { @@ -263,7 +265,7 @@ bool ShowSaveDialog(atom::NativeWindow* window, FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_OVERWRITEPROMPT, file_ext, std::vector()); - if (!save_dialog.Show(window->GetNativeWindow())) + if (!save_dialog.Show(parent_window)) return false; wchar_t file_name[MAX_PATH];