summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 21:38:50 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 21:38:50 +0000
commit9eeb35e21e43c6a91fe45b03feb9cf1d42b88b65 (patch)
tree06d0ad7b09dd3fa48a20565a622f8a5f0c6552da
parentf1cde5f421b507601fd23a7ec25962e5a1dbc3ba (diff)
downloadchromium_src-9eeb35e21e43c6a91fe45b03feb9cf1d42b88b65.zip
chromium_src-9eeb35e21e43c6a91fe45b03feb9cf1d42b88b65.tar.gz
chromium_src-9eeb35e21e43c6a91fe45b03feb9cf1d42b88b65.tar.bz2
Top level navigations are not sent to the host browser in the ChromeFrame NPAPI implementation.
These include window.open requests, hrefs with target _blank, etc. The ChromeFrame NPAPI plugin needs to set the renderer pref which indicates that the host browser can handle top level requests. We also pass an additional flag in the CreateExternal tab IPC which indicates whether the host browser supports full tab mode browsing or not. This defaults to true for IE, as the activex implementation relies on being able to launch a new window with the attach external tab prefix. which assumes support for full tab mode for IE being available. If the host browser does not support full tab browsing the window.open request which comes into the ExternalTabContainer instance creates a dummy ExternalTabContainer instance which is destroyed when the top level navigation info is sent back to the host browser. This CL is a short term fix for the issues with the NPAPI ChromeFrame plugin. Will do some investigation into a better approach. Fixes bug http://code.google.com/p/chromium/issues/detail?id=57319 Test=Covered by existing ChromeFrame widget mode tests WidgetModeIE_SrcProperty and WidgetModeFF_SrcProperty Fixed incorrect assumptions in the test files used by these tests. Bug=57319 Review URL: http://codereview.chromium.org/3549006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61117 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_provider_win.cc3
-rw-r--r--chrome/browser/external_tab_container_win.cc59
-rw-r--r--chrome/browser/external_tab_container_win.h80
-rw-r--r--chrome/test/automation/automation_messages.h7
-rw-r--r--chrome_frame/chrome_active_document.cc3
-rw-r--r--chrome_frame/chrome_frame_activex.cc8
-rw-r--r--chrome_frame/chrome_frame_automation.cc10
-rw-r--r--chrome_frame/chrome_frame_automation.h26
-rw-r--r--chrome_frame/chrome_frame_npapi.cc11
-rw-r--r--chrome_frame/chrome_frame_npapi.h3
-rw-r--r--chrome_frame/chrome_frame_npapi_unittest.cc2
-rw-r--r--chrome_frame/chrome_frame_plugin.h5
-rw-r--r--chrome_frame/delete_chrome_history.cc2
-rw-r--r--chrome_frame/test/automation_client_mock.cc16
-rw-r--r--chrome_frame/test/chrome_frame_automation_mock.h2
-rw-r--r--chrome_frame/test/data/src_property_frame1.html9
-rw-r--r--chrome_frame/test/data/src_property_frame2.html15
-rw-r--r--chrome_frame/test/data/src_property_host.html40
-rw-r--r--chrome_frame/test/proxy_factory_mock.cc10
19 files changed, 231 insertions, 80 deletions
diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc
index 98ee218..85bb7c2 100644
--- a/chrome/browser/automation/automation_provider_win.cc
+++ b/chrome/browser/automation/automation_provider_win.cc
@@ -258,7 +258,8 @@ void AutomationProvider::CreateExternalTab(
external_tab_container->Init(profile, settings.parent, settings.dimensions,
settings.style, settings.load_requests_via_automation,
settings.handle_top_level_requests, NULL, settings.initial_url,
- settings.referrer, settings.infobars_enabled);
+ settings.referrer, settings.infobars_enabled,
+ settings.route_all_top_level_navigations);
if (AddExternalTab(external_tab_container)) {
TabContents* tab_contents = external_tab_container->tab_contents();
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index d2abbb0..e591f94 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -61,7 +61,8 @@ ExternalTabContainer::ExternalTabContainer(
infobars_enabled_(true),
focus_manager_(NULL),
external_tab_view_(NULL),
- unload_reply_message_(NULL) {
+ unload_reply_message_(NULL),
+ route_all_top_level_navigations_(false) {
}
ExternalTabContainer::~ExternalTabContainer() {
@@ -77,7 +78,8 @@ bool ExternalTabContainer::Init(Profile* profile,
TabContents* existing_contents,
const GURL& initial_url,
const GURL& referrer,
- bool infobars_enabled) {
+ bool infobars_enabled,
+ bool route_all_top_level_navigations) {
if (IsWindow()) {
NOTREACHED();
return false;
@@ -86,6 +88,7 @@ bool ExternalTabContainer::Init(Profile* profile,
load_requests_via_automation_ = load_requests_via_automation;
handle_top_level_requests_ = handle_top_level_requests;
infobars_enabled_ = infobars_enabled;
+ route_all_top_level_navigations_ = route_all_top_level_navigations;
set_window_style(WS_POPUP | WS_CLIPCHILDREN);
views::WidgetWin::Init(NULL, bounds);
@@ -356,8 +359,22 @@ void ExternalTabContainer::AddNewContents(TabContents* source,
return;
}
- scoped_refptr<ExternalTabContainer> new_container =
- new ExternalTabContainer(NULL, NULL);
+ scoped_refptr<ExternalTabContainer> new_container;
+ // If the host is a browser like IE8, then the URL being navigated to in the
+ // new tab contents could potentially navigate back to Chrome from a new
+ // IE process. We support full tab mode only for IE and hence we use that as
+ // a determining factor in whether the new ExternalTabContainer instance is
+ // created as pending or not.
+ if (!route_all_top_level_navigations_) {
+ new_container = new ExternalTabContainer(NULL, NULL);
+ } else {
+ // Reuse the same tab handle here as the new container instance is a dummy
+ // instance which does not have an automation client connected at the other
+ // end.
+ new_container = new TemporaryPopupExternalTabContainer(
+ automation_, automation_resource_message_filter_.get());
+ new_container->SetTabHandle(tab_handle_);
+ }
// Make sure that ExternalTabContainer instance is initialized with
// an unwrapped Profile.
@@ -371,9 +388,13 @@ void ExternalTabContainer::AddNewContents(TabContents* source,
new_contents,
GURL(),
GURL(),
- true);
+ true,
+ route_all_top_level_navigations_);
if (result) {
+ if (route_all_top_level_navigations_) {
+ return;
+ }
uintptr_t cookie = reinterpret_cast<uintptr_t>(new_container.get());
pending_tabs_.Get()[cookie] = new_container;
new_container->set_pending(true);
@@ -545,7 +566,6 @@ bool ExternalTabContainer::HandleContextMenu(const ContextMenuParams& params) {
NOTREACHED();
return false;
}
-
external_context_menu_.reset(
new RenderViewContextMenuViews(tab_contents(), params));
external_context_menu_->SetExternal();
@@ -1020,3 +1040,30 @@ void ExternalTabContainer::SetupExternalTabView() {
// Note that SetTabContents must be called after AddChildView is called
tab_contents_container_->ChangeTabContents(tab_contents_);
}
+
+TemporaryPopupExternalTabContainer::TemporaryPopupExternalTabContainer(
+ AutomationProvider* automation,
+ AutomationResourceMessageFilter* filter)
+ : ExternalTabContainer(automation, filter) {
+}
+
+TemporaryPopupExternalTabContainer::~TemporaryPopupExternalTabContainer() {
+ DLOG(INFO) << __FUNCTION__;
+}
+
+void TemporaryPopupExternalTabContainer::OpenURLFromTab(
+ TabContents* source, const GURL& url, const GURL& referrer,
+ WindowOpenDisposition disposition, PageTransition::Type transition) {
+ if (!automation_)
+ return;
+
+ if (disposition == CURRENT_TAB) {
+ DCHECK(route_all_top_level_navigations_);
+ disposition = NEW_FOREGROUND_TAB;
+ }
+ ExternalTabContainer::OpenURLFromTab(source, url, referrer, disposition,
+ transition);
+ // support only one navigation for a dummy tab before it is killed.
+ ::DestroyWindow(GetNativeView());
+}
+
diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h
index 1148285..f1168f2 100644
--- a/chrome/browser/external_tab_container_win.h
+++ b/chrome/browser/external_tab_container_win.h
@@ -6,8 +6,10 @@
#define CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_
#pragma once
-#include <vector>
#include <map>
+#include <string>
+#include <vector>
+
#include "base/lazy_instance.h"
#include "chrome/browser/automation/automation_resource_message_filter.h"
#include "chrome/browser/browser.h"
@@ -66,7 +68,8 @@ class ExternalTabContainer : public TabContentsDelegate,
TabContents* existing_tab_contents,
const GURL& initial_url,
const GURL& referrer,
- bool infobars_enabled);
+ bool infobars_enabled,
+ bool supports_full_tab_mode);
// Unhook the keystroke listener and notify about the closing TabContents.
// This function gets called from three places, which is fine.
@@ -209,6 +212,7 @@ class ExternalTabContainer : public TabContentsDelegate,
void RunUnloadHandlers(IPC::Message* reply_message);
protected:
+ ~ExternalTabContainer();
// Overridden from views::WidgetWin:
virtual LRESULT OnCreate(LPCREATESTRUCT create_struct);
virtual void OnDestroy();
@@ -219,11 +223,8 @@ class ExternalTabContainer : public TabContentsDelegate,
int relative_offset);
void Navigate(const GURL& url, const GURL& referrer);
- private:
friend class base::RefCounted<ExternalTabContainer>;
- ~ExternalTabContainer();
-
// Helper resource automation registration method, allowing registration of
// pending RenderViewHosts.
void RegisterRenderViewHostForAutomation(RenderViewHost* render_view_host,
@@ -326,7 +327,76 @@ class ExternalTabContainer : public TabContentsDelegate,
IPC::Message* unload_reply_message_;
+ // set to true if the host needs to get notified of all top level navigations
+ // in this page. This typically applies to hosts which would render the new
+ // page without chrome frame.
+ bool route_all_top_level_navigations_;
+
DISALLOW_COPY_AND_ASSIGN(ExternalTabContainer);
};
+// This class is instantiated for handling requests to open popups for external
+// tabs hosted in browsers which need to be notified about all top level
+// navigations. An instance of this class is created for handling window.open
+// or link navigations with target blank, etc.
+class TemporaryPopupExternalTabContainer : public ExternalTabContainer {
+ public:
+ TemporaryPopupExternalTabContainer(AutomationProvider* automation,
+ AutomationResourceMessageFilter* filter);
+ virtual ~TemporaryPopupExternalTabContainer();
+
+ virtual bool OnGoToEntryOffset(int offset) {
+ NOTREACHED();
+ return false;
+ }
+
+ virtual bool ProcessUnhandledKeyStroke(HWND window, UINT message,
+ WPARAM wparam, LPARAM lparam) {
+ NOTREACHED();
+ return false;
+ }
+
+ virtual void Observe(NotificationType type, const NotificationSource& source,
+ const NotificationDetails& details) {}
+
+ virtual void OpenURLFromTab(TabContents* source, const GURL& url,
+ const GURL& referrer,
+ WindowOpenDisposition disposition,
+ PageTransition::Type transition);
+
+ virtual void NavigationStateChanged(const TabContents* source,
+ unsigned changed_flags) {
+ NOTREACHED();
+ }
+
+ virtual void CloseContents(TabContents* source) {
+ NOTREACHED();
+ }
+
+ virtual void UpdateTargetURL(TabContents* source, const GURL& url) {
+ NOTREACHED();
+ }
+
+ void ForwardMessageToExternalHost(const std::string& message,
+ const std::string& origin,
+ const std::string& target) {
+ NOTREACHED();
+ }
+
+ virtual bool TakeFocus(bool reverse) {
+ NOTREACHED();
+ return false;
+ }
+
+ virtual bool HandleContextMenu(const ContextMenuParams& params) {
+ NOTREACHED();
+ return false;
+ }
+
+ virtual void BeforeUnloadFired(TabContents* tab, bool proceed,
+ bool* proceed_to_fire_unload) {
+ NOTREACHED();
+ }
+};
+
#endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_
diff --git a/chrome/test/automation/automation_messages.h b/chrome/test/automation/automation_messages.h
index 714c527..7f30828 100644
--- a/chrome/test/automation/automation_messages.h
+++ b/chrome/test/automation/automation_messages.h
@@ -392,6 +392,7 @@ struct ExternalTabSettings {
GURL initial_url;
GURL referrer;
bool infobars_enabled;
+ bool route_all_top_level_navigations;
};
// Traits for ExternalTabSettings structure to pack/unpack.
@@ -408,6 +409,7 @@ struct ParamTraits<ExternalTabSettings> {
WriteParam(m, p.initial_url);
WriteParam(m, p.referrer);
WriteParam(m, p.infobars_enabled);
+ WriteParam(m, p.route_all_top_level_navigations);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return ReadParam(m, iter, &p->parent) &&
@@ -418,7 +420,8 @@ struct ParamTraits<ExternalTabSettings> {
ReadParam(m, iter, &p->handle_top_level_requests) &&
ReadParam(m, iter, &p->initial_url) &&
ReadParam(m, iter, &p->referrer) &&
- ReadParam(m, iter, &p->infobars_enabled);
+ ReadParam(m, iter, &p->infobars_enabled) &&
+ ReadParam(m, iter, &p->route_all_top_level_navigations);
}
static void Log(const param_type& p, std::string* l) {
l->append("(");
@@ -439,6 +442,8 @@ struct ParamTraits<ExternalTabSettings> {
LogParam(p.referrer, l);
l->append(", ");
LogParam(p.infobars_enabled, l);
+ l->append(", ");
+ LogParam(p.route_all_top_level_navigations, l);
l->append(")");
}
};
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index 78f85f2..9b24507 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -1042,7 +1042,8 @@ bool ChromeActiveDocument::LaunchUrl(const ChromeFrameUrl& cf_url,
if (profile.empty())
profile = GetHostProcessName(false);
return InitializeAutomation(profile, L"", IsIEInPrivate(),
- false, cf_url.gurl(), GURL(referrer));
+ false, cf_url.gurl(), GURL(referrer),
+ false);
}
}
diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc
index 705be34..5da61f5 100644
--- a/chrome_frame/chrome_frame_activex.cc
+++ b/chrome_frame/chrome_frame_activex.cc
@@ -460,17 +460,13 @@ HRESULT ChromeFrameActivex::IOleObject_SetClientSite(
WideToUTF8(url_, url_.Length(), &utf8_url);
}
- // Only privileged instances of ActiveX Chrome Frame controls may read
- // the chrome-network, and top-level-navigation settings from the registry.
- // See issue: 54920
- if (is_privileged_)
- InitializeAutomationSettings();
+ InitializeAutomationSettings();
url_fetcher_->set_frame_busting(!is_privileged_);
automation_client_->SetUrlFetcher(url_fetcher_.get());
if (!InitializeAutomation(profile_name, chrome_extra_arguments,
IsIEInPrivate(), true, GURL(utf8_url),
- GURL())) {
+ GURL(), false)) {
DLOG(ERROR) << "Failed to navigate to url:" << utf8_url;
return E_FAIL;
}
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc
index a97e6d0..d49c8fb 100644
--- a/chrome_frame/chrome_frame_automation.cc
+++ b/chrome_frame/chrome_frame_automation.cc
@@ -565,7 +565,8 @@ ChromeFrameAutomationClient::ChromeFrameAutomationClient()
external_tab_cookie_(0),
url_fetcher_(NULL),
url_fetcher_flags_(PluginUrlRequestManager::NOT_THREADSAFE),
- navigate_after_initialization_(false) {
+ navigate_after_initialization_(false),
+ route_all_top_level_navigations_(false) {
}
ChromeFrameAutomationClient::~ChromeFrameAutomationClient() {
@@ -719,7 +720,8 @@ bool ChromeFrameAutomationClient::InitiateNavigation(const std::string& url,
if (!chrome_launch_params_) {
FilePath profile_path;
chrome_launch_params_ = new ChromeFrameLaunchParams(parsed_url,
- referrer_gurl, profile_path, L"", L"", false, false);
+ referrer_gurl, profile_path, L"", L"", false, false,
+ route_all_top_level_navigations_);
} else {
chrome_launch_params_->set_referrer(referrer_gurl);
chrome_launch_params_->set_url(parsed_url);
@@ -937,7 +939,9 @@ void ChromeFrameAutomationClient::CreateExternalTab() {
handle_top_level_requests_,
chrome_launch_params_->url(),
chrome_launch_params_->referrer(),
- !chrome_launch_params_->widget_mode() // Infobars disabled in widget mode.
+ // Infobars disabled in widget mode.
+ !chrome_launch_params_->widget_mode(),
+ chrome_launch_params_->route_all_top_level_navigations(),
};
THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS(
diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h
index 0890fb7..8500ee7 100644
--- a/chrome_frame/chrome_frame_automation.h
+++ b/chrome_frame/chrome_frame_automation.h
@@ -110,12 +110,14 @@ class ChromeFrameLaunchParams : // NOLINT
const FilePath& profile_path,
const std::wstring& profile_name,
const std::wstring& extra_arguments,
- bool incognito, bool widget_mode)
+ bool incognito, bool widget_mode,
+ bool route_all_top_level_navigations)
: launch_timeout_(kCommandExecutionTimeout), url_(url),
referrer_(referrer), profile_path_(profile_path),
profile_name_(profile_name), extra_arguments_(extra_arguments),
version_check_(true), incognito_mode_(incognito),
- is_widget_mode_(widget_mode) {
+ is_widget_mode_(widget_mode),
+ route_all_top_level_navigations_(route_all_top_level_navigations) {
}
~ChromeFrameLaunchParams() {
@@ -173,6 +175,15 @@ class ChromeFrameLaunchParams : // NOLINT
return is_widget_mode_;
}
+ void set_route_all_top_level_navigations(
+ bool route_all_top_level_navigations) {
+ route_all_top_level_navigations_ = route_all_top_level_navigations;
+ }
+
+ bool route_all_top_level_navigations() const {
+ return route_all_top_level_navigations_;
+ }
+
protected:
int launch_timeout_;
GURL url_;
@@ -183,6 +194,7 @@ class ChromeFrameLaunchParams : // NOLINT
bool version_check_;
bool incognito_mode_;
bool is_widget_mode_;
+ bool route_all_top_level_navigations_;
private:
DISALLOW_COPY_AND_ASSIGN(ChromeFrameLaunchParams);
@@ -422,6 +434,11 @@ class ChromeFrameAutomationClient
// the website to put up a confirmation dialog on unload.
void OnUnload(bool* should_unload);
+ void set_route_all_top_level_navigations(
+ bool route_all_top_level_navigations) {
+ route_all_top_level_navigations_ = route_all_top_level_navigations;
+ }
+
protected:
// ChromeFrameAutomationProxy::LaunchDelegate implementation.
virtual void LaunchComplete(ChromeFrameAutomationProxy* proxy,
@@ -523,6 +540,11 @@ class ChromeFrameAutomationClient
PluginUrlRequestManager* url_fetcher_;
PluginUrlRequestManager::ThreadSafeFlags url_fetcher_flags_;
+ // set to true if the host needs to get notified of all top level navigations
+ // in this page. This typically applies to hosts which would render the new
+ // page without chrome frame. Defaults to false.
+ bool route_all_top_level_navigations_;
+
friend class BeginNavigateContext;
friend class CreateExternalTabContext;
};
diff --git a/chrome_frame/chrome_frame_npapi.cc b/chrome_frame/chrome_frame_npapi.cc
index 4cd889be..f0874e2 100644
--- a/chrome_frame/chrome_frame_npapi.cc
+++ b/chrome_frame/chrome_frame_npapi.cc
@@ -246,6 +246,11 @@ bool ChromeFrameNPAPI::Initialize(NPMIMEType mime_type, NPP instance,
automation_client_->set_use_chrome_network(chrome_network_arg);
}
+ static const wchar_t kHandleTopLevelRequests[] = L"HandleTopLevelRequests";
+ bool top_level_requests = GetConfigBool(true, kHandleTopLevelRequests);
+ automation_client_->set_handle_top_level_requests(top_level_requests);
+ automation_client_->set_route_all_top_level_navigations(true);
+
// Setup Url fetcher.
url_fetcher_.set_NPPInstance(instance_);
url_fetcher_.set_frame_busting(!is_privileged_);
@@ -275,7 +280,7 @@ bool ChromeFrameNPAPI::Initialize(NPMIMEType mime_type, NPP instance,
// host's in-private mode.
return InitializeAutomation(profile_name, extra_arguments,
GetBrowserIncognitoMode(), true,
- GURL(src_), GURL());
+ GURL(src_), GURL(), true);
}
void ChromeFrameNPAPI::Uninitialize() {
@@ -466,7 +471,9 @@ void ChromeFrameNPAPI::OnTabbedOut(int tab_handle, bool reverse) {
}
void ChromeFrameNPAPI::OnOpenURL(int tab_handle,
- const GURL& url, int open_disposition) {
+ const GURL& url,
+ const GURL& referrer,
+ int open_disposition) {
std::string target;
switch (open_disposition) {
case NEW_FOREGROUND_TAB:
diff --git a/chrome_frame/chrome_frame_npapi.h b/chrome_frame/chrome_frame_npapi.h
index 8fd0c6f7..994b178 100644
--- a/chrome_frame/chrome_frame_npapi.h
+++ b/chrome_frame/chrome_frame_npapi.h
@@ -132,7 +132,8 @@ END_MSG_MAP()
// instance.
virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message);
virtual void OnTabbedOut(int tab_handle, bool reverse);
- virtual void OnOpenURL(int tab_handle, const GURL& url, int open_disposition);
+ virtual void OnOpenURL(int tab_handle, const GURL& url,
+ const GURL& referrer, int open_disposition);
virtual void OnLoad(int tab_handle, const GURL& url);
virtual void OnMessageFromChromeFrame(int tab_handle,
const std::string& message,
diff --git a/chrome_frame/chrome_frame_npapi_unittest.cc b/chrome_frame/chrome_frame_npapi_unittest.cc
index 324fad1..c0a0208 100644
--- a/chrome_frame/chrome_frame_npapi_unittest.cc
+++ b/chrome_frame/chrome_frame_npapi_unittest.cc
@@ -137,7 +137,7 @@ class TestNPAPIPrivilegedApi: public ::testing::Test {
scoped_refptr<ChromeFrameLaunchParams> launch_params(
new ChromeFrameLaunchParams(GURL(), GURL(), FilePath(), profile_name,
- extra_args, is_incognito, true));
+ extra_args, is_incognito, true, false));
EXPECT_CALL(*mock_automation,
Initialize(_, LaunchParamEq(true, extra_args, is_incognito, true)))
diff --git a/chrome_frame/chrome_frame_plugin.h b/chrome_frame/chrome_frame_plugin.h
index de63b3c..6fa795e 100644
--- a/chrome_frame/chrome_frame_plugin.h
+++ b/chrome_frame/chrome_frame_plugin.h
@@ -61,7 +61,8 @@ END_MSG_MAP()
bool InitializeAutomation(const std::wstring& profile_name,
const std::wstring& extra_chrome_arguments,
bool incognito, bool is_widget_mode,
- const GURL& url, const GURL& referrer) {
+ const GURL& url, const GURL& referrer,
+ bool route_all_top_level_navigations) {
DCHECK(IsValid());
DCHECK(launch_params_ == NULL);
// We don't want to do incognito when privileged, since we're
@@ -75,7 +76,7 @@ END_MSG_MAP()
FilePath actual_profile_name = profile_path.BaseName();
launch_params_ = new ChromeFrameLaunchParams(url, referrer, profile_path,
actual_profile_name.value(), extra_chrome_arguments, incognito_mode,
- is_widget_mode);
+ is_widget_mode, route_all_top_level_navigations);
return automation_client_->Initialize(this, launch_params_);
}
diff --git a/chrome_frame/delete_chrome_history.cc b/chrome_frame/delete_chrome_history.cc
index 19eccf3..1d58df9 100644
--- a/chrome_frame/delete_chrome_history.cc
+++ b/chrome_frame/delete_chrome_history.cc
@@ -74,7 +74,7 @@ STDMETHODIMP DeleteChromeHistory::DeleteBrowsingHistory(DWORD flags) {
return S_OK;
}
if (!InitializeAutomation(GetHostProcessName(false), L"", false, false,
- GURL(), GURL())) {
+ GURL(), GURL(), true)) {
return E_UNEXPECTED;
}
diff --git a/chrome_frame/test/automation_client_mock.cc b/chrome_frame/test/automation_client_mock.cc
index 8ea09b6..7626c0b 100644
--- a/chrome_frame/test/automation_client_mock.cc
+++ b/chrome_frame/test/automation_client_mock.cc
@@ -105,7 +105,7 @@ TEST(CFACWithChrome, CreateTooFast) {
GURL empty;
scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
empty, empty, profile_path, profile_path.BaseName().value(), L"",
- false, false));
+ false, false, false));
clp->set_launch_timeout(timeout);
clp->set_version_check(false);
EXPECT_TRUE(client->Initialize(&cfd, clp));
@@ -137,7 +137,7 @@ TEST(CFACWithChrome, CreateNotSoFast) {
GURL empty;
scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
empty, empty, profile_path, profile_path.BaseName().value(), L"",
- false, false));
+ false, false, false));
clp->set_launch_timeout(timeout);
clp->set_version_check(false);
EXPECT_TRUE(client->Initialize(&cfd, clp));
@@ -183,7 +183,7 @@ TEST(CFACWithChrome, NavigateOk) {
GURL empty;
scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
empty, empty, profile_path, profile_path.BaseName().value(), L"",
- false, false));
+ false, false, false));
clp->set_launch_timeout(timeout);
clp->set_version_check(false);
EXPECT_TRUE(client->Initialize(&cfd, clp));
@@ -229,7 +229,7 @@ TEST(CFACWithChrome, NavigateFailed) {
GURL empty;
scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
empty, empty, profile_path, profile_path.BaseName().value(), L"",
- false, false));
+ false, false, false));
clp->set_launch_timeout(10000);
clp->set_version_check(false);
EXPECT_TRUE(client->Initialize(&cfd, clp));
@@ -267,7 +267,7 @@ TEST_F(CFACMockTest, MockedCreateTabOk) {
GURL empty;
scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
empty, empty, profile_path_, profile_path_.BaseName().value(), L"",
- false, false));
+ false, false, false));
clp->set_launch_timeout(timeout);
clp->set_version_check(false);
EXPECT_TRUE(client_->Initialize(&cfd_, clp));
@@ -299,7 +299,7 @@ TEST_F(CFACMockTest, MockedCreateTabFailed) {
GURL empty;
scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
empty, empty, profile_path_, profile_path_.BaseName().value(), L"",
- false, false));
+ false, false, false));
clp->set_launch_timeout(timeout_);
clp->set_version_check(false);
EXPECT_TRUE(client_->Initialize(&cfd_, clp));
@@ -339,7 +339,7 @@ TEST_F(CFACMockTest, OnChannelError) {
GURL empty;
scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
empty, empty, profile_path_, profile_path_.BaseName().value(), L"",
- false, false));
+ false, false, false));
clp->set_launch_timeout(1); // Unneeded timeout, but can't be 0.
clp->set_version_check(false);
@@ -457,7 +457,7 @@ TEST_F(CFACMockTest, NavigateTwiceAfterInitToSameUrl) {
scoped_refptr<ChromeFrameLaunchParams> launch_params(
new ChromeFrameLaunchParams(
GURL("http://www.nonexistent.com"), empty, profile_path_,
- profile_path_.BaseName().value(), L"", false, false));
+ profile_path_.BaseName().value(), L"", false, false, false));
launch_params->set_launch_timeout(timeout);
launch_params->set_version_check(false);
EXPECT_TRUE(client_->Initialize(&cfd_, launch_params));
diff --git a/chrome_frame/test/chrome_frame_automation_mock.h b/chrome_frame/test/chrome_frame_automation_mock.h
index b080bea..2d7a76e 100644
--- a/chrome_frame/test/chrome_frame_automation_mock.h
+++ b/chrome_frame/test/chrome_frame_automation_mock.h
@@ -40,7 +40,7 @@ class AutomationMockDelegate
GURL empty;
scoped_refptr<ChromeFrameLaunchParams> clp(
new ChromeFrameLaunchParams(empty, empty, profile_path, profile_name,
- extra_chrome_arguments, incognito, is_widget_mode));
+ extra_chrome_arguments, incognito, is_widget_mode, false));
clp->set_launch_timeout(launch_timeout);
clp->set_version_check(perform_version_check);
automation_client_->Initialize(this, clp);
diff --git a/chrome_frame/test/data/src_property_frame1.html b/chrome_frame/test/data/src_property_frame1.html
index 1eaa3cf..784a4c8 100644
--- a/chrome_frame/test/data/src_property_frame1.html
+++ b/chrome_frame/test/data/src_property_frame1.html
@@ -1,7 +1,14 @@
<html>
<head><title>src property test - page 1</title>
+ <script type="text/javascript" src="chrome_frame_tester_helpers.js">
+ </script>
<script type="text/javascript">
- function redirect(){
+ function redirect() {
+ if (!isRunningInChrome()) {
+ onFailure("SrcProperty", 1,
+ "src_property_frame1.html should not load in Chrome");
+ return;
+ }
window.location = "src_property_frame2.html";
}
</script>
diff --git a/chrome_frame/test/data/src_property_frame2.html b/chrome_frame/test/data/src_property_frame2.html
index c5c0364..4a7c63e 100644
--- a/chrome_frame/test/data/src_property_frame2.html
+++ b/chrome_frame/test/data/src_property_frame2.html
@@ -1,7 +1,20 @@
<html>
<head><title>src property test - page 2</title>
+ <script type="text/javascript" src="chrome_frame_tester_helpers.js">
+ </script>
+ <script type="text/javascript">
+ function onLoad() {
+ if (isRunningInChrome()) {
+ onFailure("SrcProperty", 1,
+ "src_property_frame2.html should not load in Chrome");
+ return;
+ } else {
+ onSuccess("SrcProperty", 1);
+ }
+ }
+ </script>
</head>
- <body>
+ <body onload="onLoad();">
<h2>Redirected!</h2>
<p>All finished.</p>
</body>
diff --git a/chrome_frame/test/data/src_property_host.html b/chrome_frame/test/data/src_property_host.html
index b17dd1b..ee25208 100644
--- a/chrome_frame/test/data/src_property_host.html
+++ b/chrome_frame/test/data/src_property_host.html
@@ -7,43 +7,19 @@
onFailure("ChromeFrame_SrcTest", 1, "ChromeFrame Navigation failed");
}
- var load_count = 2;
-
function OnChromeFrameLoaded(url) {
- try {
- url = url.data;
-
- var chromeFrame = GetChromeFrame();
- var frame_url = chromeFrame.src;
-
- appendStatus("Loaded URL: " + url + " Frame url: " + frame_url);
- load_count--;
+ url = url.data;
- if (load_count) {
- // For the first load, the URLs should match.
- if (frame_url != url) {
- onFailure("SrcProperty", 1, "Url: " + url);
- }
- } else {
- // Previous versions changed the frame URL when internal navigation
- // was performed. This does not match how iframes behave, and so we
- // report success only in the case that they continue to match, even
- // though the "internal" URL is different (and not visible) to the
- // external host.
- if (frame_url == url) {
- onFailure("SrcProperty", 1, "Url: " + url);
- } else {
- onSuccess("SrcProperty", 1);
- }
- }
- } catch (e) {
- onFailure("SrcProperty", 1, "OnChromeFrameLoaded: " + e.description);
- }
+ var chromeFrame = GetChromeFrame();
+ var frame_url = chromeFrame.src;
+
+ appendStatus("Loaded URL: " + url + " Frame url: " + frame_url);
}
function GetChromeFrame() {
- return window.document.ChromeFrame;
- }
+ return window.document.ChromeFrame;
+ }
+
</script>
</head>
<body>
diff --git a/chrome_frame/test/proxy_factory_mock.cc b/chrome_frame/test/proxy_factory_mock.cc
index 4e9ddbc..6e15104 100644
--- a/chrome_frame/test/proxy_factory_mock.cc
+++ b/chrome_frame/test/proxy_factory_mock.cc
@@ -21,7 +21,7 @@ TEST(ProxyFactoryTest, CreateDestroy) {
FilePath profile_path;
scoped_refptr<ChromeFrameLaunchParams> params(
new ChromeFrameLaunchParams(empty, empty, profile_path,
- L"Adam.N.Epilinter", L"", false, false));
+ L"Adam.N.Epilinter", L"", false, false, false));
params->set_launch_timeout(0);
params->set_version_check(false);
@@ -41,7 +41,7 @@ TEST(ProxyFactoryTest, CreateSameProfile) {
FilePath profile_path;
scoped_refptr<ChromeFrameLaunchParams> params(
new ChromeFrameLaunchParams(empty, empty, profile_path,
- L"Dr. Gratiano Forbeson", L"", false, false));
+ L"Dr. Gratiano Forbeson", L"", false, false, false));
params->set_launch_timeout(0);
params->set_version_check(false);
@@ -65,13 +65,13 @@ TEST(ProxyFactoryTest, CreateDifferentProfiles) {
FilePath profile_path;
scoped_refptr<ChromeFrameLaunchParams> params1(
new ChromeFrameLaunchParams(empty, empty, profile_path,
- L"Adam.N.Epilinter", L"", false, false));
+ L"Adam.N.Epilinter", L"", false, false, false));
params1->set_launch_timeout(0);
params1->set_version_check(false);
scoped_refptr<ChromeFrameLaunchParams> params2(
new ChromeFrameLaunchParams(empty, empty, profile_path,
- L"Dr. Gratiano Forbeson", L"", false, false));
+ L"Dr. Gratiano Forbeson", L"", false, false, false));
params2->set_launch_timeout(0);
params2->set_version_check(false);
@@ -95,7 +95,7 @@ TEST(ProxyFactoryTest, FastCreateDestroy) {
FilePath profile_path;
scoped_refptr<ChromeFrameLaunchParams> params(
new ChromeFrameLaunchParams(empty, empty, profile_path,
- L"Dr. Gratiano Forbeson", L"", false, false));
+ L"Dr. Gratiano Forbeson", L"", false, false, false));
params->set_launch_timeout(10000);
params->set_version_check(false);