diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 21:47:16 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 21:47:16 +0000 |
commit | d9d8f0c234ea70e6c5121c038c3c6ab33699f903 (patch) | |
tree | b755aee455afacf4bb88950ab74e6876ad85dd39 /chrome_frame/chrome_active_document.h | |
parent | 1b8a1b648148a058b2c03d89398a65038992732f (diff) | |
download | chromium_src-d9d8f0c234ea70e6c5121c038c3c6ab33699f903.zip chromium_src-d9d8f0c234ea70e6c5121c038c3c6ab33699f903.tar.gz chromium_src-d9d8f0c234ea70e6c5121c038c3c6ab33699f903.tar.bz2 |
Added full support for invoking before unload and unload handlers on ChromeFrame rendered
pages. This allows a webpage to put up a confirmation dialog in its beforeunload handler
and potentially cancel the operation. We only support invoking unload handlers on the page
for IE full tab mode. To achieve this the active document handles the OLECMDID_ONUNLOAD
exec command which is passed by the DOCHOST to the object which allows us to potentially
cancel the operation.
Thanks to Stoyan for his help in authoring parts of this CL.
The AutomationMsg_RunUnloadHandlers message which is used only by ChromeFrame is now a sync
message which returns back a bool indicating whether the unload operation can be continued
or not. The ExternalTabContainer now implements the BeforeUnloadFired method in the
TabContentsDelegate and aborts the unload operation if the user chose to not proceed with
the unload.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=33200
Bug=33200
Test=Covered by existing unload event test. Will add a test which validates whether a page
can cancel the unload operation in a subsequent CL.
Review URL: http://codereview.chromium.org/3450014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59854 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_active_document.h')
-rw-r--r-- | chrome_frame/chrome_active_document.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/chrome_frame/chrome_active_document.h b/chrome_frame/chrome_active_document.h index 146f091..370ba32 100644 --- a/chrome_frame/chrome_active_document.h +++ b/chrome_frame/chrome_active_document.h @@ -276,6 +276,7 @@ BEGIN_EXEC_COMMAND_MAP(ChromeActiveDocument) OnDisplayPrivacyInfo) EXEC_COMMAND_HANDLER(NULL, OLECMDID_OPTICAL_GETZOOMRANGE, OnGetZoomRange) EXEC_COMMAND_HANDLER(NULL, OLECMDID_OPTICAL_ZOOM, OnSetZoomRange) + EXEC_COMMAND_HANDLER(NULL, OLECMDID_ONUNLOAD, OnUnload) END_EXEC_COMMAND_MAP() // IPCs from automation server. @@ -390,6 +391,12 @@ END_EXEC_COMMAND_MAP() void OnSetZoomRange(const GUID* cmd_group_guid, DWORD command_id, DWORD cmd_exec_opt, VARIANT* in_args, VARIANT* out_args); + // This function handles the OLECMDID_ONUNLOAD command. It enables Chrome to + // invoke before unload and unload handlers on the page if any, thereby + // enabling a webpage to potentially cancel the operation. + void OnUnload(const GUID* cmd_group_guid, DWORD command_id, + DWORD cmd_exec_opt, VARIANT* in_args, VARIANT* out_args); + // Call exec on our site's command target HRESULT IEExec(const GUID* cmd_group_guid, DWORD command_id, DWORD cmd_exec_opt, VARIANT* in_args, VARIANT* out_args); |