diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 21:32:19 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 21:32:19 +0000 |
commit | 3eb8a7049a1678c35845c10e95ecc4bf303b59e2 (patch) | |
tree | ac63296aaca85259b015036af4d34acccbb62ea1 /chrome_frame/chrome_active_document.cc | |
parent | 2d8099cf56475b6989911ea8e573cbeb26724f3d (diff) | |
download | chromium_src-3eb8a7049a1678c35845c10e95ecc4bf303b59e2.zip chromium_src-3eb8a7049a1678c35845c10e95ecc4bf303b59e2.tar.gz chromium_src-3eb8a7049a1678c35845c10e95ecc4bf303b59e2.tar.bz2 |
Refreshing a ChromeFrame page which was received in response to a top level POST to a page
in IE should reissue the POST request after bringing up a confirmation dialog.
This CL adds support to ChromeFrame to achieve this. Ideally we would want IE to display
the confirmation dialog for the POST. However the doc object host which is implemented by
IEFrame expects the doc object to implement the IHTMLDocument interface and a bunch of private
interfaces.
To reissue the POST request we save away the POST data and headers in the navigation manager
instance which is per BHO. When we refresh the page in ChromeFrame the active document on
seeing that we have posted data issues a navigation back to the URL with the posted data
and saved headers. All other refreshes continue to work the same way as before, i.e. the
refresh request is sent to Chrome on the automation channel. The confirmation dialog is
put up by the active document with the same text and caption as that in Chrome.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=64901
BUG=64901
TEST=Covered by new ChromeFrame unit test
Review URL: http://codereview.chromium.org/5595002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68213 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_active_document.cc')
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index 6000505..deee511 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -74,6 +74,7 @@ HRESULT ChromeActiveDocument::FinalConstruct() { // optimization to get Chrome active documents to load faster. ChromeActiveDocument* cached_document = g_active_doc_cache.Get(); if (cached_document && cached_document->IsValid()) { + SetResourceModule(); DCHECK(automation_client_.get() == NULL); automation_client_.swap(cached_document->automation_client_); DVLOG(1) << "Reusing automation client instance from " << cached_document; @@ -1070,6 +1071,37 @@ HRESULT ChromeActiveDocument::OnRefreshPage(const GUID* cmd_group_guid, 0x80000000 | OLECMDIDF_WINDOWSTATE_USERVISIBLE_VALID, NULL, NULL); } + NavigationManager* mgr = NavigationManager::GetThreadInstance(); + DLOG_IF(ERROR, !mgr) << "Couldn't get instance of NavigationManager"; + + // If ChromeFrame was activated on this page as a result of a document + // received in response to a top level post, then we ask the user for + // permission to repost and issue a navigation with the saved post data + // which reinitates the whole sequence, i.e. the server receives the top + // level post and chrome frame will be reactivated in response. + if (mgr && mgr->post_data().type() != VT_EMPTY) { + if (MessageBox( + SimpleResourceLoader::Get(IDS_HTTP_POST_WARNING).c_str(), + SimpleResourceLoader::Get(IDS_HTTP_POST_WARNING_TITLE).c_str(), + MB_YESNO | MB_ICONEXCLAMATION) == IDYES) { + base::win::ScopedComPtr<IWebBrowser2> web_browser2; + DoQueryService(SID_SWebBrowserApp, m_spClientSite, + web_browser2.Receive()); + DCHECK(web_browser2); + VARIANT empty = base::win::ScopedVariant::kEmptyVariant; + VARIANT flags = { VT_I4 }; + V_I4(&flags) = navNoHistory; + + return web_browser2->Navigate2(base::win::ScopedVariant(url_).AsInput(), + &flags, + &empty, + const_cast<VARIANT*>(&mgr->post_data()), + const_cast<VARIANT*>(&mgr->headers())); + } else { + return S_OK; + } + } + TabProxy* tab_proxy = GetTabProxy(); if (tab_proxy) { tab_proxy->ReloadAsync(); |