diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-17 01:19:04 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-17 01:19:04 +0000 |
commit | e3a91e7d2cb359692c59b86a29453f1931f87760 (patch) | |
tree | 83d18e33d0041e888e580dee0e81b15cf3d490fc /chrome_frame/chrome_active_document.cc | |
parent | 584245e578427abc2bc19f224609f820ad71aca0 (diff) | |
download | chromium_src-e3a91e7d2cb359692c59b86a29453f1931f87760.zip chromium_src-e3a91e7d2cb359692c59b86a29453f1931f87760.tar.gz chromium_src-e3a91e7d2cb359692c59b86a29453f1931f87760.tar.bz2 |
window.open calls issued by pages within ChromeFrame would not honor the suggested dimensions and would end up
opening a default top level browser window in IE.
ChromeFrame does receive the dimensions from the external tab container when it is notified about a popup being
opened.
Fix is to honor these dimensions by passing them off in the specially crafted url containing other arguments.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=42250
This fix is currently implemented for IE full tab mode only.
Bug=42250
Test=Covered by augmenting the existing window open test to also validate the window size. Added a new unit test
to test the ParseAttachExternalTabUrl helper function.
Review URL: http://codereview.chromium.org/2867007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50064 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_active_document.cc')
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index 3223edd..2b8e222 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -65,7 +65,8 @@ ChromeActiveDocument::ChromeActiveDocument() : first_navigation_(true), is_automation_client_reused_(false), popup_allowed_(false), - accelerator_table_(NULL) { + accelerator_table_(NULL), + is_new_navigation_(false) { TRACE_EVENT_BEGIN("chromeframe.createactivedocument", this, ""); url_fetcher_.set_frame_busting(false); @@ -519,6 +520,23 @@ HRESULT ChromeActiveDocument::ActiveXDocActivate(LONG verb) { } else { m_hWnd = Create(parent_window, position_rect, 0, 0, WS_EX_CLIENTEDGE); } + + ScopedComPtr<IWebBrowser2> web_browser2; + DoQueryService(SID_SWebBrowserApp, m_spClientSite, + web_browser2.Receive()); + if (web_browser2) { + if (!dimensions_.IsEmpty()) { + web_browser2->put_Width(dimensions_.width()); + web_browser2->put_Height(dimensions_.height()); + web_browser2->put_Left(dimensions_.x()); + web_browser2->put_Top(dimensions_.y()); + web_browser2->put_MenuBar(VARIANT_FALSE); + web_browser2->put_ToolBar(VARIANT_FALSE); + + dimensions_.set_height(0); + dimensions_.set_width(0); + } + } } SetObjectRects(&position_rect, &clip_rect); } @@ -976,14 +994,13 @@ bool ChromeActiveDocument::LaunchUrl(const std::wstring& url, std::string utf8_url; if (!is_new_navigation) { - WStringTokenizer tokenizer(url, L"&"); - // Skip over kChromeAttachExternalTabPrefix - tokenizer.GetNext(); - + int disposition = 0; uint64 external_tab_cookie = 0; - if (tokenizer.GetNext()) { - wchar_t* end_ptr = 0; - external_tab_cookie = _wcstoui64(tokenizer.token().c_str(), &end_ptr, 10); + + if (!ParseAttachExternalTabUrl(url, &external_tab_cookie, &dimensions_, + &disposition)) { + NOTREACHED() << "Failed to parse attach tab url:" << url; + return false; } if (external_tab_cookie == 0) { @@ -991,8 +1008,10 @@ bool ChromeActiveDocument::LaunchUrl(const std::wstring& url, return false; } + is_new_navigation_ = false; automation_client_->AttachExternalTab(external_tab_cookie); } else { + is_new_navigation_ = true; // Initiate navigation before launching chrome so that the url will be // cached and sent with launch settings. if (url_.Length()) { |