Store NativeWindow's weak ptr in WebContents

This commit is contained in:
Cheng Zhao 2015-06-24 22:14:46 +08:00
parent 2532318bee
commit 2bfa9da82e
5 changed files with 33 additions and 6 deletions

View file

@ -65,12 +65,15 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
if (!item)
return;
NativeWindow* window = nullptr;
auto relay = NativeWindowRelay::FromWebContents(item->GetWebContents());
if (relay)
window = relay->window.get();
file_dialog::Filters filters;
base::FilePath path;
auto owner_window_ = NativeWindow::FromWebContents(item->GetWebContents());
if (!file_dialog::ShowSaveDialog(
owner_window_, item->GetURL().spec(),
default_path, filters, &path)) {
if (!file_dialog::ShowSaveDialog(window, item->GetURL().spec(), default_path,
filters, &path)) {
return;
}