diff options
author | jennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-31 02:09:49 +0000 |
---|---|---|
committer | jennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-31 02:09:49 +0000 |
commit | 9d6c803bf6b2c0f750f5113ff48de7f0c90647ee (patch) | |
tree | 70999a51fe0a70845cbdefb493e3073b3e95e16f /ui/web_dialogs | |
parent | 854bfc1371e7eb0eb1a3d686504a27e7d0a8e557 (diff) | |
download | chromium_src-9d6c803bf6b2c0f750f5113ff48de7f0c90647ee.zip chromium_src-9d6c803bf6b2c0f750f5113ff48de7f0c90647ee.tar.gz chromium_src-9d6c803bf6b2c0f750f5113ff48de7f0c90647ee.tar.bz2 |
Fix the issue introduced by hooking window.onbeforeunload in WebDialogView which breaks the way WebDialogUI closing the dialog via "DialogClose" message from js. This is broken by my svn landed yesterday.
https://src.chromium.org/viewvc/chrome?view=rev&revision=179427
Since we fire window.onbeforeunload event in WebDialogView, which makes dialog closing async now, we can't have WebDialogUI calls WebDialogDelegate::OnDialogClosed directly in response to "DialogClose" message. I added a new callback WebDialogDelegate::OnDialogCloseFromWebUI to support this case.
While WebDialogDelegate is still used by WebDialogGtk, I provided a default WebDialogDelegate::OnDialogClosedFromWebUI implementation, which just calls WebDialogDelegate::OnDialogClosedFromWebUI, so that the gtk code flow should still work the same as before.
BUG=172067
Review URL: https://chromiumcodereview.appspot.com/12091075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/web_dialogs')
-rw-r--r-- | ui/web_dialogs/web_dialog_delegate.cc | 5 | ||||
-rw-r--r-- | ui/web_dialogs/web_dialog_delegate.h | 4 | ||||
-rw-r--r-- | ui/web_dialogs/web_dialog_ui.cc | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/ui/web_dialogs/web_dialog_delegate.cc b/ui/web_dialogs/web_dialog_delegate.cc index 7e920cc..ed41410 100644 --- a/ui/web_dialogs/web_dialog_delegate.cc +++ b/ui/web_dialogs/web_dialog_delegate.cc @@ -14,6 +14,11 @@ void WebDialogDelegate::GetMinimumDialogSize(gfx::Size* size) const { GetDialogSize(size); } +void WebDialogDelegate::OnDialogCloseFromWebUI( + const std::string& json_retval) { + OnDialogClosed(json_retval); +} + bool WebDialogDelegate::HandleContextMenu( const content::ContextMenuParams& params) { return false; diff --git a/ui/web_dialogs/web_dialog_delegate.h b/ui/web_dialogs/web_dialog_delegate.h index 6a1d08d..3a6ec4f 100644 --- a/ui/web_dialogs/web_dialog_delegate.h +++ b/ui/web_dialogs/web_dialog_delegate.h @@ -79,6 +79,10 @@ class WEB_DIALOGS_EXPORT WebDialogDelegate { // registering it as a message handler in the WebUI object). virtual void OnDialogClosed(const std::string& json_retval) = 0; + // A callback to notify the delegate that the dialog is being closed in + // response to a "DialogClose" message from WebUI. + virtual void OnDialogCloseFromWebUI(const std::string& json_retval); + // A callback to notify the delegate that the contents have gone // away. Only relevant if your dialog hosts code that calls // windows.close() and you've allowed that. If the output parameter diff --git a/ui/web_dialogs/web_dialog_ui.cc b/ui/web_dialogs/web_dialog_ui.cc index 5f87096..d4f0740 100644 --- a/ui/web_dialogs/web_dialog_ui.cc +++ b/ui/web_dialogs/web_dialog_ui.cc @@ -110,7 +110,7 @@ void WebDialogUI::OnDialogClosed(const ListValue* args) { if (args && !args->empty() && !args->GetString(0, &json_retval)) NOTREACHED() << "Could not read JSON argument"; - delegate->OnDialogClosed(json_retval); + delegate->OnDialogCloseFromWebUI(json_retval); } } |