summaryrefslogtreecommitdiffstats
path: root/chrome/browser/external_tab_container.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-17 00:12:52 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-17 00:12:52 +0000
commit1a98a93fc1977683c3789dedbef2806b3fcdf5b4 (patch)
tree4a8b6aa1e55e0d2d93e9f646f3bdde3aaa98cab4 /chrome/browser/external_tab_container.cc
parentf09d9379d6e654e7fd95b9d601b1e77f1ac13c3d (diff)
downloadchromium_src-1a98a93fc1977683c3789dedbef2806b3fcdf5b4.zip
chromium_src-1a98a93fc1977683c3789dedbef2806b3fcdf5b4.tar.gz
chromium_src-1a98a93fc1977683c3789dedbef2806b3fcdf5b4.tar.bz2
amit, please review everything, jam please review the changes to the tab_contents and the
renderer_host sources. Remove the AutomationProfileImpl class which wraps the Chrome profile for an external tab container, which hosts ChromeFrame. This object was used to carry a custom URL request context which was used to intercept HTTP requests and cookie requests issued by external tabs. However as the life time of the automation profile class depended on the lifetime of the external tab container object this caused a number of crashes in objects which held on to the automation profile pointer retrieved from the associated tab contents. This does not happen in a regualar Chrome browser instance as the profile is deleted at the very end. We can associate the automation URL request context with the underlying tab_contents which would eventually percolate down to the resource message filter. Doing this would avoid the need for the AutomationProfile class. This CL achieves that. Bug=27695,27662 Review URL: http://codereview.chromium.org/385117 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/external_tab_container.cc')
-rw-r--r--chrome/browser/external_tab_container.cc45
1 files changed, 29 insertions, 16 deletions
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc
index 806c4c6..9689ade 100644
--- a/chrome/browser/external_tab_container.cc
+++ b/chrome/browser/external_tab_container.cc
@@ -81,17 +81,6 @@ bool ExternalTabContainer::Init(Profile* profile,
// is the same as the lifetime of the window
SetProp(GetNativeView(), kWindowObjectKey, this);
- 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();
- }
-
if (existing_contents) {
tab_contents_ = existing_contents;
tab_contents_->controller().set_profile(profile);
@@ -182,6 +171,11 @@ void ExternalTabContainer::Uninitialize() {
delete tab_contents_;
tab_contents_ = NULL;
}
+
+ if (request_context_.get()) {
+ AutomationRequestContext::CleanupRequestContext(
+ request_context_.release());
+ }
}
bool ExternalTabContainer::Reinitialize(
@@ -202,11 +196,6 @@ bool ExternalTabContainer::Reinitialize(
rvh->process()->id(), rvh->routing_id(),
tab_handle_, automation_resource_message_filter_);
}
-
- DCHECK(automation_profile_.get() != NULL);
- Profile* profile = tab_contents_->profile()->GetOriginalProfile();
- DCHECK(profile != NULL);
- automation_profile_->Initialize(profile, filter);
}
// We cannot send the navigation state right away as the automation channel
@@ -218,6 +207,13 @@ bool ExternalTabContainer::Reinitialize(
return true;
}
+void ExternalTabContainer::SetTabHandle(int handle) {
+ tab_handle_ = handle;
+ if (load_requests_via_automation_) {
+ InitializeAutomationRequestContext(handle);
+ }
+}
+
void ExternalTabContainer::ProcessUnhandledAccelerator(const MSG& msg) {
DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
}
@@ -700,3 +696,20 @@ bool ExternalTabContainer::OnGoToEntryOffset(int offset) {
return true;
}
+
+void ExternalTabContainer::InitializeAutomationRequestContext(
+ int tab_handle) {
+ if (request_context_.get()) {
+ AutomationRequestContext::CleanupRequestContext(
+ request_context_.release());
+ }
+
+ request_context_ =
+ AutomationRequestContext::CreateAutomationURLRequestContextForTab(
+ tab_handle, tab_contents_->profile(),
+ automation_resource_message_filter_);
+
+ DCHECK(request_context_.get() != NULL);
+ tab_contents_->set_request_context(request_context_.get());
+}
+