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 4324339ce563ca489757c39e17b723729abac8f1..6c7f730a6661ad876545cac28d461863758d4f48 100644 |
--- a/content/browser/tab_contents/tab_contents.cc |
+++ b/content/browser/tab_contents/tab_contents.cc |
@@ -14,10 +14,12 @@ |
#include "base/time.h" |
#include "base/utf_string_conversions.h" |
#include "content/browser/browser_context.h" |
+#include "content/browser/browsing_instance_frame_id.h" |
#include "content/browser/child_process_security_policy.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" |
@@ -167,6 +169,8 @@ void MakeNavigateParams(const NavigationEntry& entry, |
GetNavigationType(controller.browser_context(), entry, reload_type); |
params->request_time = base::Time::Now(); |
params->extra_headers = entry.extra_headers(); |
+ params->opener_browsing_instance_frame_id = |
+ entry.opener_browsing_instance_frame_id(); |
params->transferred_request_child_id = |
entry.transferred_global_request_id().child_id; |
params->transferred_request_request_id = |
@@ -217,9 +221,18 @@ 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), |
+ browsing_instance_frame_( |
+ browser_context->frame_mapper().AllocateNewTopLevelFrameId()) { |
render_manager_.Init(browser_context, site_instance, routing_id); |
+ // TODO(supersat): This is a hack and should be removed. |
+ if (routing_id > 0) { |
+ browser_context->frame_mapper().UpdateFrame( |
+ browsing_instance_frame_, render_view_host()->process()->GetID(), |
+ 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 ? |
@@ -263,6 +276,11 @@ TabContents::~TabContents() { |
base::TimeTicks::Now() - tab_close_start_time_); |
} |
+ // Remove the top-level frame from the frame mapper |
+ browser_context()->frame_mapper().RemoveFrame(browsing_instance_frame_); |
+ // TODO(supersat): This should probably remove the proxy on the other side |
+ delete browsing_instance_frame_; |
+ |
FOR_EACH_OBSERVER(TabContentsObserver, observers_, TabContentsDestroyed()); |
set_delegate(NULL); |
@@ -1306,6 +1324,14 @@ void TabContents::DidNavigateMainFramePostCommit( |
displayed_insecure_content_ = false; |
} |
+ DLOG(WARNING) << "DidNavigateMainFramePostCommit: " << |
+ params.url << ", " << params.frame_id; |
+ content::FrameMap& mapper = browser_context()->frame_mapper(); |
+ mapper.UpdateFrame(browsing_instance_frame_, |
+ render_view_host()->process()->GetID(), |
+ render_view_host()->routing_id(), |
+ params.frame_id); |
+ |
// Notify observers about navigation. |
FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
DidNavigateMainFrame(details, params)); |
@@ -1323,6 +1349,13 @@ void TabContents::DidNavigateAnyFramePostCommit( |
dialog_creator_ = NULL; |
} |
+ // TODO(supersat): Logging for debugging purposes only. |
+ DLOG(WARNING) << "DidNavigateAnyFramePostCommit: " |
+ << "bifi = " << browsing_instance_frame_->id() |
+ << ", process id = " << render_view_host->process()->GetID() |
+ << ", rvh route = " << render_view_host->routing_id() |
+ << ", frame_id = " << params.frame_id << ", url = " << |
+ params.url; |
// Notify observers about navigation. |
FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
DidNavigateAnyFrame(details, params)); |
@@ -1744,17 +1777,19 @@ void TabContents::DocumentOnLoadCompletedInMainFrame( |
void TabContents::RequestOpenURL(const GURL& url, |
const content::Referrer& referrer, |
WindowOpenDisposition disposition, |
- int64 source_frame_id) { |
+ int64 source_frame_id, |
+ int64 opener_browsing_instance_frame_id) { |
// Delegate to RequestTransferURL because this is just the generic |
// case where |old_request_id| is empty. |
RequestTransferURL(url, referrer, disposition, source_frame_id, |
- GlobalRequestID()); |
+ opener_browsing_instance_frame_id, GlobalRequestID()); |
} |
void TabContents::RequestTransferURL(const GURL& url, |
const content::Referrer& referrer, |
WindowOpenDisposition disposition, |
int64 source_frame_id, |
+ int64 opener_browsing_instance_frame_id, |
const GlobalRequestID& old_request_id) { |
TabContents* new_contents = NULL; |
content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; |
@@ -1775,7 +1810,8 @@ void TabContents::RequestTransferURL(const GURL& url, |
transition_type = render_manager_.web_ui()->link_transition_type(); |
} else { |
OpenURLParams params(url, referrer, disposition, |
- content::PAGE_TRANSITION_LINK, true /* is_renderer_initiated */); |
+ content::PAGE_TRANSITION_LINK, true /* is_renderer_initiated */, |
+ opener_browsing_instance_frame_id); |
params.transferred_global_request_id = old_request_id; |
new_contents = OpenURL(params); |
} |