Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2116)

Unified Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 10827078: Support frame tree propagation between renderers in the same browsing instance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another round of fixes based on Charlie's review. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 4e1c71fa8d2f8db46bf7045d857130c34ace49cb..65036d949a8ee5fa6beb1f09440e17d29ee63791 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -11,6 +11,7 @@
#include "base/i18n/rtl.h"
#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "base/message_loop.h"
#include "base/stl_util.h"
#include "base/string_util.h"
@@ -28,6 +29,7 @@
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/common/accessibility_messages.h"
+#include "content/common/content_constants_internal.h"
#include "content/common/desktop_notification_messages.h"
#include "content/common/drag_messages.h"
#include "content/common/inter_process_time_ticks_converter.h"
@@ -930,6 +932,7 @@ bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) {
OnDomOperationResponse)
IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications,
OnAccessibilityNotifications)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_FrameTreeUpdated, OnFrameTreeUpdated)
// Have the super handle all other messages.
IPC_MESSAGE_UNHANDLED(
handled = RenderWidgetHostImpl::OnMessageReceived(msg))
@@ -1134,6 +1137,21 @@ void RenderViewHostImpl::OnMsgNavigate(const IPC::Message& msg) {
FilterURL(policy, renderer_id, true, &validated_params.password_form.action);
delegate_->DidNavigate(this, validated_params);
+
+ // For top level navigations, if there is no frame tree present for this
+ // instance (for example when the window is first created), then create
+ // an unnamed one with the proper frame id from the renderer.
+ // This should be done after we called DidNavigate, since updating the frame
+ // tree expects the render view being updated to be the active one.
+ if (content::PageTransitionIsMainFrame(validated_params.transition)) {
+ if (frame_tree_.empty()) {
+ base::DictionaryValue tree;
+ tree.SetString(content::kFrameTreeNodeNameKey, std::string());
+ tree.SetInteger(content::kFrameTreeNodeIdKey, validated_params.frame_id);
+ base::JSONWriter::Write(&tree, &frame_tree_);
+ delegate_->DidUpdateFrameTree(this);
+ }
+ }
}
void RenderViewHostImpl::OnMsgUpdateState(int32 page_id,
@@ -1620,6 +1638,17 @@ webkit_glue::WebPreferences RenderViewHostImpl::GetWebkitPreferences() {
return delegate_->GetWebkitPrefs();
}
+void RenderViewHostImpl::UpdateFrameTree(
+ int process_id,
+ int route_id,
+ const std::string& frame_tree) {
+ frame_tree_ = frame_tree;
+ Send(new ViewMsg_UpdateFrameTree(GetRoutingID(),
+ process_id,
+ route_id,
+ frame_tree_));
+}
+
void RenderViewHostImpl::UpdateWebkitPreferences(
const webkit_glue::WebPreferences& prefs) {
Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs));
@@ -1855,6 +1884,11 @@ void RenderViewHostImpl::OnDomOperationResponse(
content::Details<DomOperationNotificationDetails>(&details));
}
+void RenderViewHostImpl::OnFrameTreeUpdated(const std::string& frame_tree) {
+ frame_tree_ = frame_tree;
+ delegate_->DidUpdateFrameTree(this);
+}
+
void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) {
is_swapped_out_ = is_swapped_out;

Powered by Google App Engine
This is Rietveld 408576698