diff options
author | twiz@google.com <twiz@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 22:36:09 +0000 |
---|---|---|
committer | twiz@google.com <twiz@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 22:36:09 +0000 |
commit | 8103c7fa6b614bf834b080962bdc28465ebe612b (patch) | |
tree | 0d0df40bff18ed832060bdd85969bf232f91117f /chrome_frame | |
parent | a19124714ececf0de3c5b7b69b013fbbdec9a1b3 (diff) | |
download | chromium_src-8103c7fa6b614bf834b080962bdc28465ebe612b.zip chromium_src-8103c7fa6b614bf834b080962bdc28465ebe612b.tar.gz chromium_src-8103c7fa6b614bf834b080962bdc28465ebe612b.tar.bz2 |
Change correcting the profile used when performing top-level navigations of the host browser with a ChromeFrame instance. If a ChromeFrame instance was loaded with a given profile, the bho used to always forward top-level navigation requests to a CF full-tab instance using the default (iexplore) profile. This caused problems with the automation channel, and the navigation would not complete.
I also cleaned up the gcf and host networking registry keys used by Chrome-Frame so that ActiveX instances will also respect their values.
TEST=None
BUG=None
Review URL: http://codereview.chromium.org/3295019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58884 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 14 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_activex_base.h | 16 | ||||
-rw-r--r-- | chrome_frame/test/util_unittests.cc | 36 | ||||
-rw-r--r-- | chrome_frame/utils.cc | 8 | ||||
-rw-r--r-- | chrome_frame/utils.h | 5 |
5 files changed, 57 insertions, 22 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index b083982..e48a8b8 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -43,9 +43,6 @@ #include "chrome_frame/crash_reporting/crash_metrics.h" #include "chrome_frame/utils.h" -static const wchar_t kUseChromeNetworking[] = L"UseChromeNetworking"; -static const wchar_t kHandleTopLevelRequests[] = L"HandleTopLevelRequests"; - DEFINE_GUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46); @@ -96,11 +93,6 @@ HRESULT ChromeActiveDocument::FinalConstruct() { return hr; } - bool chrome_network = GetConfigBool(false, kUseChromeNetworking); - bool top_level_requests = GetConfigBool(true, kHandleTopLevelRequests); - automation_client_->set_use_chrome_network(chrome_network); - automation_client_->set_handle_top_level_requests(top_level_requests); - find_dialog_.Init(automation_client_.get()); OLECMDF flags = static_cast<OLECMDF>(OLECMDF_ENABLED | OLECMDF_SUPPORTED); @@ -1023,7 +1015,11 @@ bool ChromeActiveDocument::LaunchUrl(const ChromeFrameUrl& cf_url, if (launch_params_) { return automation_client_->Initialize(this, launch_params_); } else { - return InitializeAutomation(GetHostProcessName(false), L"", IsIEInPrivate(), + std::wstring profile = UTF8ToWide(cf_url.profile_name()); + // If no profile was given, then make use of the host process's name. + if (profile.empty()) + profile = GetHostProcessName(false); + return InitializeAutomation(profile, L"", IsIEInPrivate(), false, cf_url.gurl(), GURL(referrer)); } } diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h index c2c4035..de08d9a 100644 --- a/chrome_frame/chrome_frame_activex_base.h +++ b/chrome_frame/chrome_frame_activex_base.h @@ -37,6 +37,9 @@ // Include without path to make GYP build see it. #include "chrome_tab.h" // NOLINT +static const wchar_t kUseChromeNetworking[] = L"UseChromeNetworking"; +static const wchar_t kHandleTopLevelRequests[] = L"HandleTopLevelRequests"; + // Connection point class to support firing IChromeFrameEvents (dispinterface). template<class T> class ATL_NO_VTABLE ProxyDIChromeFrameEvents @@ -264,6 +267,14 @@ END_MSG_MAP() IE_8, IE_8 + 1); } + + // Query and assign the host networking and top-level-request settings + // from the registry. + bool chrome_network = GetConfigBool(false, kUseChromeNetworking); + bool top_level_requests = GetConfigBool(true, kHandleTopLevelRequests); + automation_client_->set_use_chrome_network(chrome_network); + automation_client_->set_handle_top_level_requests(top_level_requests); + return S_OK; } @@ -510,7 +521,7 @@ END_MSG_MAP() GURL parsed_url(WideToUTF8(wide_url)); std::string url = - StringPrintf("%hs:%hs?attach_external_tab&%I64u&%d&%d&%d&%d&%d", + StringPrintf("%hs:%hs?attach_external_tab&%I64u&%d&%d&%d&%d&%d&%hs", parsed_url.scheme().c_str(), parsed_url.host().c_str(), params.cookie, @@ -518,7 +529,8 @@ END_MSG_MAP() params.dimensions.x(), params.dimensions.y(), params.dimensions.width(), - params.dimensions.height()); + params.dimensions.height(), + params.profile_name.c_str()); HostNavigate(GURL(url), GURL(), params.disposition); } diff --git a/chrome_frame/test/util_unittests.cc b/chrome_frame/test/util_unittests.cc index 8d91434..e265567 100644 --- a/chrome_frame/test/util_unittests.cc +++ b/chrome_frame/test/util_unittests.cc @@ -121,20 +121,26 @@ TEST(UtilTests, GetTempInternetFiles) { TEST(UtilTests, ParseAttachTabUrlTest) { ChromeFrameUrl cf_url; - EXPECT_TRUE(cf_url.Parse(L"http://f/?attach_external_tab&10&1&2&3&123&321")); + static const std::string kProfileName("iexplore"); + + EXPECT_TRUE(cf_url.Parse( + L"http://f/?attach_external_tab&10&1&2&3&123&321&iexplore")); EXPECT_TRUE(cf_url.attach_to_external_tab()); EXPECT_FALSE(cf_url.is_chrome_protocol()); EXPECT_EQ(10, cf_url.cookie()); EXPECT_EQ(1, cf_url.disposition()); EXPECT_EQ(gfx::Rect(2, 3, 123, 321), cf_url.dimensions()); + EXPECT_EQ(kProfileName, cf_url.profile_name()); - EXPECT_TRUE(cf_url.Parse(L"http://www.foobar.com?&10&1&2&3&123&321")); + EXPECT_TRUE(cf_url.Parse( + L"http://www.foobar.com?&10&1&2&3&123&321&iexplore")); EXPECT_FALSE(cf_url.attach_to_external_tab()); EXPECT_FALSE(cf_url.is_chrome_protocol()); EXPECT_EQ(0, cf_url.cookie()); EXPECT_EQ(0, cf_url.disposition()); EXPECT_EQ(gfx::Rect(0, 0, 0, 0), cf_url.dimensions()); + EXPECT_TRUE(cf_url.profile_name().empty()); EXPECT_FALSE(cf_url.Parse(L"attach_external_tab&10&1")); EXPECT_FALSE(cf_url.attach_to_external_tab()); @@ -142,13 +148,16 @@ TEST(UtilTests, ParseAttachTabUrlTest) { EXPECT_EQ(0, cf_url.cookie()); EXPECT_EQ(0, cf_url.disposition()); EXPECT_EQ(gfx::Rect(0, 0, 0, 0), cf_url.dimensions()); + EXPECT_TRUE(cf_url.profile_name().empty()); - EXPECT_TRUE(cf_url.Parse(L"gcf:http://f/?attach_tab&10&1&2&3&123&321")); + EXPECT_TRUE(cf_url.Parse( + L"gcf:http://f/?attach_tab&10&1&2&3&123&321&iexplore")); EXPECT_FALSE(cf_url.attach_to_external_tab()); EXPECT_TRUE(cf_url.is_chrome_protocol()); EXPECT_EQ(0, cf_url.cookie()); EXPECT_EQ(0, cf_url.disposition()); EXPECT_EQ(gfx::Rect(0, 0, 0, 0), cf_url.dimensions()); + EXPECT_TRUE(cf_url.profile_name().empty()); EXPECT_TRUE(cf_url.Parse(L"gcf:http://google.com")); EXPECT_FALSE(cf_url.attach_to_external_tab()); @@ -157,6 +166,7 @@ TEST(UtilTests, ParseAttachTabUrlTest) { EXPECT_EQ(0, cf_url.disposition()); EXPECT_EQ(gfx::Rect(0, 0, 0, 0), cf_url.dimensions()); EXPECT_EQ(cf_url.gurl(), GURL("http://google.com")); + EXPECT_TRUE(cf_url.profile_name().empty()); } // Mock for the IInternetSecurityManager interface @@ -226,33 +236,37 @@ TEST(UtilTests, CanNavigateTest) { { " ", false, false, false }, { "foo bar", true, false, false }, - //non-privileged test cases - { "http://blah/?attach_external_tab&10&1&0&0&100&100", false, true, true }, + // non-privileged test cases + { "http://blah/?attach_external_tab&10&1&0&0&100&100&iexplore", false, + true, true }, { "http://untrusted/bar.html", false, false, true }, - { "http://blah/?attach_external_tab&10&1&0&0&100&100", false, true, true }, + { "http://blah/?attach_external_tab&10&1&0&0&100&100&iexplore", false, + true, true }, { "view-source:http://www.google.ca", false, true, true }, { "view-source:javascript:alert('foo');", false, false, true }, { "about:blank", false, true, true }, { "About:Version", false, true, true }, { "about:config", false, false, true }, { "chrome-extension://aaaaaaaaaaaaaaaaaaa/toolstrip.html", false, false, - true }, + true }, { "ftp://www.google.ca", false, false, true }, { "file://www.google.ca", false, false, true }, { "file://C:\boot.ini", false, false, true }, { "SIP:someone@10.1.2.3", false, false, true }, - //privileged test cases - { "http://blah/?attach_external_tab&10&1&0&0&100&100", true, true, true }, + // privileged test cases + { "http://blah/?attach_external_tab&10&1&0&0&100&100&iexplore", true, true, + true }, { "http://untrusted/bar.html", true, false, true }, - { "http://blah/?attach_external_tab&10&1&0&0&100&100", true, true, true }, + { "http://blah/?attach_external_tab&10&1&0&0&100&100&iexplore", true, true, + true }, { "view-source:http://www.google.ca", true, true, true }, { "view-source:javascript:alert('foo');", true, false, true }, { "about:blank", true, true, true }, { "About:Version", true, true, true }, { "about:config", true, false, true }, { "chrome-extension://aaaaaaaaaaaaaaaaaaa/toolstrip.html", true, true, - true }, + true }, { "ftp://www.google.ca", true, false, true }, { "file://www.google.ca", true, false, true }, { "file://C:\boot.ini", true, false, true }, diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc index 31cf389..26bab06 100644 --- a/chrome_frame/utils.cc +++ b/chrome_frame/utils.cc @@ -1355,6 +1355,13 @@ bool ChromeFrameUrl::ParseAttachExternalTabUrl() { } else { return false; } + + if (tokenizer.GetNext()) { + profile_name_ = tokenizer.token(); + } else { + return false; + } + return true; } @@ -1364,6 +1371,7 @@ void ChromeFrameUrl::Reset() { cookie_ = 0; dimensions_.SetRect(0, 0, 0, 0); disposition_ = 0; + profile_name_.clear(); } bool CanNavigate(const GURL& url, IInternetSecurityManager* security_manager, diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h index 0587fdd..e0da6ac 100644 --- a/chrome_frame/utils.h +++ b/chrome_frame/utils.h @@ -517,6 +517,10 @@ class ChromeFrameUrl { return parsed_url_; } + const std::string& profile_name() const { + return profile_name_; + } + private: // If we are attaching to an existing external tab, this function parses the // suffix portion of the URL which contains the attach_external_tab prefix. @@ -532,6 +536,7 @@ class ChromeFrameUrl { int disposition_; GURL parsed_url_; + std::string profile_name_; }; // Returns true if we can navigate to this URL. |