diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-17 22:28:06 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-17 22:28:06 +0000 |
commit | 7b237e271b323ebb5e92ddc5c134ea1f15a641e3 (patch) | |
tree | 5a3cc91468a7baabf6f857aad3bf14c3c9470f90 /chrome_frame | |
parent | 1590b7ba918f421004a50330851836c6397595c8 (diff) | |
download | chromium_src-7b237e271b323ebb5e92ddc5c134ea1f15a641e3.zip chromium_src-7b237e271b323ebb5e92ddc5c134ea1f15a641e3.tar.gz chromium_src-7b237e271b323ebb5e92ddc5c134ea1f15a641e3.tar.bz2 |
Add rudimentary support in the ChromeFrame ActiveX to enable it work in a generic client site, i.e.
a non IE client site. Some of our users are creating apps which host ChromeFrame to render web pages.
This enables them to use the chrome network stack by setting up a privileged chrome frame container
and setting the corresponding properties on the ChromeFrame ActiveX.
It mostly works well. However things like window.open break down as we need the ability in the ActiveX
to be able to connect to an existing ExternalTabContainer instance. This works well in IE where the IWebBrowser
implementation initiates the navigation correctly. However a generic implementation of the IWebBrowser interface
does not do this.
Fixes are to add a new function to the IChromeFramePrivileged interface which allows hosts to pass in the
navigation url early in the lifetime of the ActiveX. In the ChromeFrame ActiveX we check if the url coming in
is for an attach tab request and if so initiate the same.
Fixes portions of bug https://code.google.com/p/chromium/issues/detail?id=137335
BUG=137335
Review URL: https://chromiumcodereview.appspot.com/10783007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147109 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/chrome_frame_activex.cc | 28 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_activex.h | 6 | ||||
-rw-r--r-- | chrome_frame/chrome_tab.idl | 3 |
3 files changed, 33 insertions, 4 deletions
diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc index 654f640..84db59f 100644 --- a/chrome_frame/chrome_frame_activex.cc +++ b/chrome_frame/chrome_frame_activex.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -147,7 +147,8 @@ void GetMiniContextMenuData(UINT cmd, } // namespace chrome_frame ChromeFrameActivex::ChromeFrameActivex() - : chrome_wndproc_hook_(NULL) { + : chrome_wndproc_hook_(NULL), + attaching_to_existing_cf_tab_(false) { TRACE_EVENT_BEGIN_ETW("chromeframe.createactivex", this, ""); } @@ -410,7 +411,16 @@ STDMETHODIMP ChromeFrameActivex::put_src(BSTR src) { return E_ACCESSDENIED; } } - return Base::put_src(src); + HRESULT hr = S_OK; + // If we are connecting to an existing ExternalTabContainer instance in + // Chrome then we should wait for Chrome to initiate the navigation. + if (!attaching_to_existing_cf_tab_) { + hr = Base::put_src(src); + } else { + url_.Reset(::SysAllocString(src)); + attaching_to_existing_cf_tab_ = false; + } + return S_OK; } HRESULT ChromeFrameActivex::IOleObject_SetClientSite( @@ -470,6 +480,18 @@ HRESULT ChromeFrameActivex::IOleObject_SetClientSite( InitializeAutomationSettings(); + if (service) { + base::win::ScopedBstr navigation_url; + service->GetNavigationUrl(navigation_url.Receive()); + if (navigation_url.Length()) { + ChromeFrameUrl cf_url; + cf_url.Parse(navigation_url.operator BSTR()); + if (cf_url.attach_to_external_tab()) { + automation_client_->AttachExternalTab(cf_url.cookie()); + attaching_to_existing_cf_tab_ = true; + } + } + } url_fetcher_->set_frame_busting(!is_privileged()); automation_client_->SetUrlFetcher(url_fetcher_.get()); if (!InitializeAutomation(profile_name, IsIEInPrivate(), true, diff --git a/chrome_frame/chrome_frame_activex.h b/chrome_frame/chrome_frame_activex.h index 9fea94b..3023649 100644 --- a/chrome_frame/chrome_frame_activex.h +++ b/chrome_frame/chrome_frame_activex.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -139,6 +139,10 @@ END_MSG_MAP() // A hook attached to the top-level window containing the ActiveX control. HHOOK chrome_wndproc_hook_; + + // Set to true if the current instance is attaching to an existing Chrome + // tab. This occurs when a window.open request is performed by Chrome. + bool attaching_to_existing_cf_tab_; }; #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_H_ diff --git a/chrome_frame/chrome_tab.idl b/chrome_frame/chrome_tab.idl index 4d11ea4..3e1af75 100644 --- a/chrome_frame/chrome_tab.idl +++ b/chrome_frame/chrome_tab.idl @@ -102,6 +102,9 @@ interface IChromeFramePrivileged : IUnknown { // a dialog should be showed to the user by this CF instance, S_FALSE if // not. HRESULT ShouldShowVersionMismatchDialog(); + // Allows the host to return the navigation url during the creation of the + // ChromeFrameActiveX instance. + HRESULT GetNavigationUrl([out] BSTR* url); }; // Expose this service to the ChromeFrame control to trigger privileged |