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

Side by Side 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: Let the reviews begin :) 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
14 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
15 #include "base/json/json_writer.h"
15 #include "base/message_loop.h" 16 #include "base/message_loop.h"
16 #include "base/stl_util.h" 17 #include "base/stl_util.h"
17 #include "base/string_util.h" 18 #include "base/string_util.h"
18 #include "base/time.h" 19 #include "base/time.h"
19 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
20 #include "base/values.h" 21 #include "base/values.h"
21 #include "content/browser/child_process_security_policy_impl.h" 22 #include "content/browser/child_process_security_policy_impl.h"
22 #include "content/browser/cross_site_request_manager.h" 23 #include "content/browser/cross_site_request_manager.h"
23 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 24 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
24 #include "content/browser/gpu/gpu_surface_tracker.h" 25 #include "content/browser/gpu/gpu_surface_tracker.h"
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, 937 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel,
937 OnCancelDesktopNotification) 938 OnCancelDesktopNotification)
938 #if defined(OS_MACOSX) 939 #if defined(OS_MACOSX)
939 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) 940 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup)
940 #endif 941 #endif
941 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) 942 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser)
942 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, 943 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse,
943 OnDomOperationResponse) 944 OnDomOperationResponse)
944 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications, 945 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications,
945 OnAccessibilityNotifications) 946 OnAccessibilityNotifications)
947 IPC_MESSAGE_HANDLER(ViewHostMsg_FrameTree, OnFrameTree)
946 // Have the super handle all other messages. 948 // Have the super handle all other messages.
947 IPC_MESSAGE_UNHANDLED( 949 IPC_MESSAGE_UNHANDLED(
948 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) 950 handled = RenderWidgetHostImpl::OnMessageReceived(msg))
949 IPC_END_MESSAGE_MAP_EX() 951 IPC_END_MESSAGE_MAP_EX()
950 952
951 if (!msg_is_ok) { 953 if (!msg_is_ok) {
952 // The message had a handler, but its de-serialization failed. 954 // The message had a handler, but its de-serialization failed.
953 // Kill the renderer. 955 // Kill the renderer.
954 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); 956 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH"));
955 GetProcess()->ReceivedBadMessage(); 957 GetProcess()->ReceivedBadMessage();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 FilterURL(policy, renderer_id, true, &validated_params.referrer.url); 1142 FilterURL(policy, renderer_id, true, &validated_params.referrer.url);
1141 for (std::vector<GURL>::iterator it(validated_params.redirects.begin()); 1143 for (std::vector<GURL>::iterator it(validated_params.redirects.begin());
1142 it != validated_params.redirects.end(); ++it) { 1144 it != validated_params.redirects.end(); ++it) {
1143 FilterURL(policy, renderer_id, false, &(*it)); 1145 FilterURL(policy, renderer_id, false, &(*it));
1144 } 1146 }
1145 FilterURL(policy, renderer_id, true, &validated_params.searchable_form_url); 1147 FilterURL(policy, renderer_id, true, &validated_params.searchable_form_url);
1146 FilterURL(policy, renderer_id, true, &validated_params.password_form.origin); 1148 FilterURL(policy, renderer_id, true, &validated_params.password_form.origin);
1147 FilterURL(policy, renderer_id, true, &validated_params.password_form.action); 1149 FilterURL(policy, renderer_id, true, &validated_params.password_form.action);
1148 1150
1149 delegate_->DidNavigate(this, validated_params); 1151 delegate_->DidNavigate(this, validated_params);
1152
1153 // For top level navigations, if there is no frame tree present for this
1154 // instance (for example when the window is first created), then create
1155 // an unnamed one with the proper frame id from the renderer.
1156 // This should be done after we called DidNavigate, since updating the frame
1157 // tree expects the render view being updated to be the active one.
1158 if (content::PageTransitionIsMainFrame(validated_params.transition)) {
1159 if (frame_tree_.empty()) {
1160 base::DictionaryValue tree;
1161 tree.SetString("name", std::string());
1162 tree.SetInteger("id", validated_params.frame_id);
1163 base::JSONWriter::Write(&tree, &frame_tree_);
1164 delegate_->DidUpdateFrameTree(this);
1165 }
1166 }
1150 } 1167 }
1151 1168
1152 void RenderViewHostImpl::OnMsgUpdateState(int32 page_id, 1169 void RenderViewHostImpl::OnMsgUpdateState(int32 page_id,
1153 const std::string& state) { 1170 const std::string& state) {
1154 delegate_->UpdateState(this, page_id, state); 1171 delegate_->UpdateState(this, page_id, state);
1155 } 1172 }
1156 1173
1157 void RenderViewHostImpl::OnMsgUpdateTitle( 1174 void RenderViewHostImpl::OnMsgUpdateTitle(
1158 int32 page_id, 1175 int32 page_id,
1159 const string16& title, 1176 const string16& title,
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 RejectMouseLockOrUnlockIfNecessary(); 1643 RejectMouseLockOrUnlockIfNecessary();
1627 // We need to notify the contents that its fullscreen state has changed. This 1644 // We need to notify the contents that its fullscreen state has changed. This
1628 // is done as part of the resize message. 1645 // is done as part of the resize message.
1629 WasResized(); 1646 WasResized();
1630 } 1647 }
1631 1648
1632 webkit_glue::WebPreferences RenderViewHostImpl::GetWebkitPreferences() { 1649 webkit_glue::WebPreferences RenderViewHostImpl::GetWebkitPreferences() {
1633 return delegate_->GetWebkitPrefs(); 1650 return delegate_->GetWebkitPrefs();
1634 } 1651 }
1635 1652
1653 const std::string& RenderViewHostImpl::GetFrameTree() {
awong 2012/08/20 21:56:31 Should this method be const?
nasko 2012/08/21 00:34:45 Done.
1654 return frame_tree_;
1655 }
1656
1657 void RenderViewHostImpl::UpdateFrameTree(
1658 int process_id, int route_id, const std::string& frame_tree) {
1659 frame_tree_ = frame_tree;
1660
1661 Send(new ViewMsg_FrameTree(GetRoutingID(),
1662 process_id,
1663 route_id,
1664 frame_tree_));
1665 }
1666
1636 void RenderViewHostImpl::UpdateWebkitPreferences( 1667 void RenderViewHostImpl::UpdateWebkitPreferences(
1637 const webkit_glue::WebPreferences& prefs) { 1668 const webkit_glue::WebPreferences& prefs) {
1638 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); 1669 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs));
1639 } 1670 }
1640 1671
1641 void RenderViewHostImpl::ClearFocusedNode() { 1672 void RenderViewHostImpl::ClearFocusedNode() {
1642 Send(new ViewMsg_ClearFocusedNode(GetRoutingID())); 1673 Send(new ViewMsg_ClearFocusedNode(GetRoutingID()));
1643 } 1674 }
1644 1675
1645 void RenderViewHostImpl::SetZoomLevel(double level) { 1676 void RenderViewHostImpl::SetZoomLevel(double level) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 1892
1862 void RenderViewHostImpl::OnDomOperationResponse( 1893 void RenderViewHostImpl::OnDomOperationResponse(
1863 const std::string& json_string, int automation_id) { 1894 const std::string& json_string, int automation_id) {
1864 DomOperationNotificationDetails details(json_string, automation_id); 1895 DomOperationNotificationDetails details(json_string, automation_id);
1865 content::NotificationService::current()->Notify( 1896 content::NotificationService::current()->Notify(
1866 content::NOTIFICATION_DOM_OPERATION_RESPONSE, 1897 content::NOTIFICATION_DOM_OPERATION_RESPONSE,
1867 content::Source<RenderViewHost>(this), 1898 content::Source<RenderViewHost>(this),
1868 content::Details<DomOperationNotificationDetails>(&details)); 1899 content::Details<DomOperationNotificationDetails>(&details));
1869 } 1900 }
1870 1901
1902 void RenderViewHostImpl::OnFrameTree(const std::string& frame_tree) {
1903 frame_tree_ = frame_tree;
1904 delegate_->DidUpdateFrameTree(this);
1905 }
1906
1871 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) { 1907 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) {
1872 is_swapped_out_ = is_swapped_out; 1908 is_swapped_out_ = is_swapped_out;
1873 1909
1874 // Whenever we change swap out state, we should not be waiting for 1910 // Whenever we change swap out state, we should not be waiting for
1875 // beforeunload or unload acks. We clear them here to be safe, since they 1911 // beforeunload or unload acks. We clear them here to be safe, since they
1876 // can cause navigations to be ignored in OnMsgNavigate. 1912 // can cause navigations to be ignored in OnMsgNavigate.
1877 is_waiting_for_beforeunload_ack_ = false; 1913 is_waiting_for_beforeunload_ack_ = false;
1878 is_waiting_for_unload_ack_ = false; 1914 is_waiting_for_unload_ack_ = false;
1879 } 1915 }
1880 1916
1881 void RenderViewHostImpl::ClearPowerSaveBlockers() { 1917 void RenderViewHostImpl::ClearPowerSaveBlockers() {
1882 STLDeleteValues(&power_save_blockers_); 1918 STLDeleteValues(&power_save_blockers_);
1883 } 1919 }
1884 1920
1885 } // namespace content 1921 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698