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

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: Moved away from hardcoded strings and no static cast needed for tests. 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 95e3e9280fcc35a1a836f0a5c5f5ac581bce4693..88b5dce8d7ce62f44e3ec06fc315648e8eb07bcf 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -12,6 +12,7 @@
#include "base/command_line.h"
#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"
@@ -32,6 +33,7 @@
#include "content/common/drag_messages.h"
#include "content/common/inter_process_time_ticks_converter.h"
#include "content/common/speech_recognition_messages.h"
+#include "content/common/string_constants.h"
#include "content/common/swapped_out_messages.h"
#include "content/common/view_messages.h"
#include "content/port/browser/render_view_host_delegate_view.h"
@@ -943,6 +945,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))
@@ -1147,6 +1150,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,
@@ -1633,6 +1651,15 @@ 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));
@@ -1868,6 +1895,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