Index: content/browser/tab_contents/tab_contents.cc |
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc |
index 390acb4f80225c0a3ab3f47c21b6cbbdb5048403..cba3b4406b38f933cb2a463c207999c984f71a6d 100644 |
--- a/content/browser/tab_contents/tab_contents.cc |
+++ b/content/browser/tab_contents/tab_contents.cc |
@@ -14,9 +14,11 @@ |
#include "base/time.h" |
#include "base/utf_string_conversions.h" |
#include "content/browser/child_process_security_policy.h" |
+#include "content/browser/content_frame.h" |
#include "content/browser/debugger/devtools_manager_impl.h" |
#include "content/browser/download/download_manager.h" |
#include "content/browser/download/download_stats.h" |
+#include "content/browser/frame_map.h" |
#include "content/browser/host_zoom_map.h" |
#include "content/browser/in_process_webkit/session_storage_namespace.h" |
#include "content/browser/intents/intents_host_impl.h" |
@@ -184,7 +186,7 @@ void MakeNavigateParams(const NavigationEntry& entry, |
TabContents::TabContents(content::BrowserContext* browser_context, |
SiteInstance* site_instance, |
int routing_id, |
- const TabContents* base_tab_contents, |
+ content::ContentFrame* opener, |
SessionStorageNamespace* session_storage_namespace) |
: delegate_(NULL), |
ALLOW_THIS_IN_INITIALIZER_LIST(controller_( |
@@ -216,13 +218,23 @@ TabContents::TabContents(content::BrowserContext* browser_context, |
static_cast<int>(content::kMaximumZoomFactor * 100)), |
temporary_zoom_settings_(false), |
content_restrictions_(0), |
- view_type_(content::VIEW_TYPE_TAB_CONTENTS) { |
+ view_type_(content::VIEW_TYPE_TAB_CONTENTS), |
+ content_frame_( |
+ browser_context->frame_mapper().InitializeFrame( |
awong
2011/12/21 01:56:07
Is it possible for to change InitializeFrame() so
supersat
2011/12/23 03:22:46
Previously, no. Now, yes.
|
+ browser_context->frame_mapper().AllocateFrameId(), |
+ true, *this, opener)) { |
render_manager_.Init(browser_context, site_instance, routing_id); |
+ // TODO(supersat): This is a hack and should be removed. |
+ browser_context->frame_mapper().UpdateFrame( |
+ content_frame_, render_view_host()->process()->GetID(), |
+ render_view_host()->routing_id(), |
+ -1 /* We don't know the frame id yet */); |
+ |
// We have the initial size of the view be based on the size of the passed in |
// tab contents (normally a tab from the same window). |
- view_->CreateView(base_tab_contents ? |
- base_tab_contents->view()->GetContainerSize() : gfx::Size()); |
+ view_->CreateView(opener ? |
+ opener->tab_contents().view()->GetContainerSize() : gfx::Size()); |
#if defined(ENABLE_JAVA_BRIDGE) |
java_bridge_dispatcher_host_manager_.reset( |
@@ -262,6 +274,10 @@ TabContents::~TabContents() { |
base::TimeTicks::Now() - tab_close_start_time_); |
} |
+ // Remove the top-level frame from the frame mapper |
+ browser_context()->frame_mapper().RemoveFrame(content_frame_); |
+ delete content_frame_; |
+ |
FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed()); |
set_delegate(NULL); |
@@ -698,7 +714,7 @@ TabContents* TabContents::Clone() { |
TabContents* tc = new TabContents( |
browser_context(), |
SiteInstance::CreateSiteInstance(browser_context()), |
- MSG_ROUTING_NONE, this, NULL); |
+ MSG_ROUTING_NONE, content_frame_, NULL); |
tc->controller().CopyStateFrom(controller_); |
return tc; |
} |
@@ -2000,7 +2016,7 @@ TabContents::GetLastCommittedNavigationEntryForRenderManager() { |
} |
bool TabContents::CreateRenderViewForRenderManager( |
- RenderViewHost* render_view_host) { |
+ RenderViewHost* render_view_host, int opener_route_id) { |
// Can be NULL during tests. |
RenderWidgetHostView* rwh_view = view_->CreateViewForWidget(render_view_host); |
@@ -2013,7 +2029,8 @@ bool TabContents::CreateRenderViewForRenderManager( |
int32 max_page_id = |
GetMaxPageIDForSiteInstance(render_view_host->site_instance()); |
- if (!render_view_host->CreateRenderView(string16(), max_page_id)) |
+ if (!render_view_host->CreateRenderView(string16(), opener_route_id, |
+ max_page_id)) |
return false; |
#if defined(OS_LINUX) || defined(OS_OPENBSD) |