summaryrefslogtreecommitdiffstats
path: root/chrome/browser/external_tab_container.cc
diff options
context:
space:
mode:
authoramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 13:28:11 +0000
committeramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 13:28:11 +0000
commit5f450e5c6fc98a762cebb38cd080731bedd61ae3 (patch)
treede1e6a257709c220222a6ab9defac23aade6e45c /chrome/browser/external_tab_container.cc
parent60147f3b071444f0abfb320e62a0c9f2b666d443 (diff)
downloadchromium_src-5f450e5c6fc98a762cebb38cd080731bedd61ae3.zip
chromium_src-5f450e5c6fc98a762cebb38cd080731bedd61ae3.tar.gz
chromium_src-5f450e5c6fc98a762cebb38cd080731bedd61ae3.tar.bz2
Navigation and cookies for Automation
Give Automation better visibility and control over navigations. Also, make it possible for automation to implement a dummy cookie store to go with dummy request serving over automation. BUG=none TEST=none Review URL: http://codereview.chromium.org/159189 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21836 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/external_tab_container.cc')
-rw-r--r--chrome/browser/external_tab_container.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc
index ab74af1..ee4eb85 100644
--- a/chrome/browser/external_tab_container.cc
+++ b/chrome/browser/external_tab_container.cc
@@ -46,7 +46,8 @@ bool ExternalTabContainer::Init(Profile* profile,
HWND parent,
const gfx::Rect& bounds,
DWORD style,
- bool load_requests_via_automation) {
+ bool load_requests_via_automation,
+ bool handle_top_level_requests) {
if (IsWindow()) {
NOTREACHED();
return false;
@@ -66,8 +67,25 @@ bool ExternalTabContainer::Init(Profile* profile,
// is the same as the lifetime of the window
SetProp(GetNativeView(), kWindowObjectKey, this);
+ // If we are sending top level requests through the automation then
+ // we should be using automation to load url requests as well.
+ DCHECK(handle_top_level_requests ? load_requests_via_automation : 1);
+
+ if (load_requests_via_automation) {
+ // Customize our profile.
+ // TODO(joshia): If we are loading requests via automation
+ // and handling cookies in automation then it's probably better to
+ // use OTR profile so that cookies are not persisted in chrome.
+ automation_profile_.reset(new AutomationProfileImpl);
+ automation_profile_->Initialize(profile,
+ automation_resource_message_filter_);
+ profile = automation_profile_.get();
+ }
+
tab_contents_ = new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL);
tab_contents_->set_delegate(this);
+ tab_contents_->GetMutableRendererPrefs()->browser_handles_top_level_requests =
+ handle_top_level_requests;
tab_contents_->render_view_host()->AllowBindings(
BindingsPolicy::EXTERNAL_HOST);
@@ -163,13 +181,16 @@ void ExternalTabContainer::OpenURLFromTab(TabContents* source,
case SINGLETON_TAB:
case NEW_FOREGROUND_TAB:
case NEW_BACKGROUND_TAB:
+ case NEW_POPUP:
case NEW_WINDOW:
+ case SAVE_TO_DISK:
if (automation_) {
automation_->Send(new AutomationMsg_OpenURL(0, tab_handle_,
url, disposition));
}
break;
default:
+ NOTREACHED();
break;
}
}