summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-05 19:34:27 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-05 19:34:27 +0000
commit74b1eaf54677c2e33556a924549ae25604ef1a2c (patch)
tree0904dac00c355e7420e7980248dec0a0a514fd44
parentc0bb39fcbe11a4fa51467a1c2046d0516143a82d (diff)
downloadchromium_src-74b1eaf54677c2e33556a924549ae25604ef1a2c.zip
chromium_src-74b1eaf54677c2e33556a924549ae25604ef1a2c.tar.gz
chromium_src-74b1eaf54677c2e33556a924549ae25604ef1a2c.tar.bz2
Ensure that foreground tabs which are opened up as new windows in IE6 come to the
foreground. Fixes bug http://code.google.com/p/chromium/issues/detail?id=99063 BUG=99063 Review URL: http://codereview.chromium.org/8136012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104151 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome_frame/chrome_active_document.cc13
-rw-r--r--chrome_frame/chrome_frame_activex_base.h52
2 files changed, 42 insertions, 23 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index 49085d3..4f77f78 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -757,6 +757,19 @@ void ChromeActiveDocument::UpdateNavigationState(
url_.Allocate(UTF8ToWide(new_navigation_info.url.spec()).c_str());
if (is_internal_navigation) {
+ // IE6 does not support tabs. If Chrome sent us a window open request
+ // indicating that the navigation needs to occur in a foreground tab or
+ // a popup window, then we need to ensure that the new window in IE6 is
+ // brought to the foreground.
+ if (GetIEVersion() == IE_6 &&
+ is_attach_external_tab_url &&
+ (cf_url.disposition() == NEW_FOREGROUND_TAB ||
+ cf_url.disposition() == NEW_POPUP)) {
+ base::win::ScopedComPtr<IWebBrowser2> wb2;
+ DoQueryService(SID_SWebBrowserApp, m_spClientSite, wb2.Receive());
+ if (wb2)
+ BaseActiveX::BringWebBrowserWindowToTop(wb2);
+ }
base::win::ScopedComPtr<IDocObjectService> doc_object_svc;
base::win::ScopedComPtr<IWebBrowserEventsService> web_browser_events_svc;
diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h
index 7808bd5..500f9fa 100644
--- a/chrome_frame/chrome_frame_activex_base.h
+++ b/chrome_frame/chrome_frame_activex_base.h
@@ -385,6 +385,16 @@ END_MSG_MAP()
return true;
}
+ static void BringWebBrowserWindowToTop(IWebBrowser2* web_browser2) {
+ DCHECK(web_browser2);
+ if (web_browser2) {
+ web_browser2->put_Visible(VARIANT_TRUE);
+ HWND ie_window = NULL;
+ web_browser2->get_HWND(reinterpret_cast<long*>(&ie_window));
+ ::BringWindowToTop(ie_window);
+ }
+ }
+
protected:
virtual void GetProfilePath(const std::wstring& profile_name,
FilePath* profile_path) {
@@ -480,28 +490,10 @@ END_MSG_MAP()
}
virtual void OnAttachExternalTab(const AttachExternalTabParams& params) {
- std::wstring wide_url = url_;
- GURL parsed_url(WideToUTF8(wide_url));
-
- // If Chrome-Frame is presently navigated to an extension page, navigating
- // the host to a url with scheme chrome-extension will fail, so we
- // point the host at http:local_host. Note that this is NOT the URL
- // to which the host is directed. It is only used as a temporary message
- // passing mechanism between this CF instance, and the BHO that will
- // be constructed in the new IE tab.
- if (parsed_url.SchemeIs("chrome-extension") &&
- is_privileged()) {
- const char kScheme[] = "http";
- const char kHost[] = "local_host";
-
- GURL::Replacements r;
- r.SetScheme(kScheme, url_parse::Component(0, sizeof(kScheme) -1));
- r.SetHost(kHost, url_parse::Component(0, sizeof(kHost) - 1));
- parsed_url = parsed_url.ReplaceComponents(r);
- }
-
- std::string url = chrome_frame::ActiveXCreateUrl(parsed_url, params);
- HostNavigate(GURL(url), GURL(), chrome_frame::GetDisposition(params));
+ GURL current_url(static_cast<BSTR>(url_));
+ std::string url = chrome_frame::ActiveXCreateUrl(current_url, params);
+ // Pass the current document url as the referrer for the new navigation.
+ HostNavigate(GURL(url), current_url, chrome_frame::GetDisposition(params));
}
virtual void OnHandleContextMenu(const ContextMenuModel& menu_model,
@@ -1165,6 +1157,21 @@ END_MSG_MAP()
http_headers.Set(referrer_header.c_str());
}
+ // IE6 does not support tabs. If Chrome sent us a window open request
+ // indicating that the navigation needs to occur in a foreground tab or
+ // a popup window, then we need to ensure that the new window in IE6 is
+ // brought to the foreground.
+ if (ie_version == IE_6) {
+ ChromeFrameUrl cf_url;
+ cf_url.Parse(static_cast<BSTR>(url_));
+
+ if (cf_url.attach_to_external_tab() &&
+ (cf_url.disposition() == NEW_FOREGROUND_TAB ||
+ cf_url.disposition() == NEW_POPUP)) {
+ BringWebBrowserWindowToTop(web_browser2);
+ }
+ }
+
HRESULT hr = web_browser2->Navigate2(url.AsInput(), &flags, &empty, &empty,
http_headers.AsInput());
// If the current window is a popup window then attempting to open a new
@@ -1175,7 +1182,6 @@ END_MSG_MAP()
V_I4(&flags) = navOpenInNewWindow;
hr = web_browser2->Navigate2(url.AsInput(), &flags, &empty, &empty,
http_headers.AsInput());
-
DLOG_IF(ERROR, FAILED(hr))
<< "Navigate2 failed with error: "
<< base::StringPrintf("0x%08X", hr);