Chromium Code Reviews| 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..1312a2c253d15ad116cea21575b1d5e245e41827 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/renderer_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) { |
|
Charlie Reis
2012/08/22 22:08:34
Style: These each need to be on their own line if
nasko
2012/08/23 21:55:53
Done.
|
| + 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; |