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

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: Another round of fixes based on Charlie's review. Created 8 years, 3 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/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
14 #include "base/json/json_writer.h"
14 #include "base/message_loop.h" 15 #include "base/message_loop.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "base/time.h" 18 #include "base/time.h"
18 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
19 #include "base/values.h" 20 #include "base/values.h"
20 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 21 #include "content/browser/accessibility/browser_accessibility_state_impl.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"
25 #include "content/browser/host_zoom_map_impl.h" 26 #include "content/browser/host_zoom_map_impl.h"
26 #include "content/browser/power_save_blocker.h" 27 #include "content/browser/power_save_blocker.h"
27 #include "content/browser/renderer_host/dip_util.h" 28 #include "content/browser/renderer_host/dip_util.h"
28 #include "content/browser/renderer_host/render_process_host_impl.h" 29 #include "content/browser/renderer_host/render_process_host_impl.h"
29 #include "content/browser/renderer_host/render_view_host_delegate.h" 30 #include "content/browser/renderer_host/render_view_host_delegate.h"
30 #include "content/common/accessibility_messages.h" 31 #include "content/common/accessibility_messages.h"
32 #include "content/common/content_constants_internal.h"
31 #include "content/common/desktop_notification_messages.h" 33 #include "content/common/desktop_notification_messages.h"
32 #include "content/common/drag_messages.h" 34 #include "content/common/drag_messages.h"
33 #include "content/common/inter_process_time_ticks_converter.h" 35 #include "content/common/inter_process_time_ticks_converter.h"
34 #include "content/common/speech_recognition_messages.h" 36 #include "content/common/speech_recognition_messages.h"
35 #include "content/common/swapped_out_messages.h" 37 #include "content/common/swapped_out_messages.h"
36 #include "content/common/view_messages.h" 38 #include "content/common/view_messages.h"
37 #include "content/port/browser/render_view_host_delegate_view.h" 39 #include "content/port/browser/render_view_host_delegate_view.h"
38 #include "content/port/browser/render_widget_host_view_port.h" 40 #include "content/port/browser/render_widget_host_view_port.h"
39 #include "content/public/browser/browser_accessibility_state.h" 41 #include "content/public/browser/browser_accessibility_state.h"
40 #include "content/public/browser/browser_context.h" 42 #include "content/public/browser/browser_context.h"
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, 925 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel,
924 OnCancelDesktopNotification) 926 OnCancelDesktopNotification)
925 #if defined(OS_MACOSX) 927 #if defined(OS_MACOSX)
926 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) 928 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup)
927 #endif 929 #endif
928 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) 930 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser)
929 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, 931 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse,
930 OnDomOperationResponse) 932 OnDomOperationResponse)
931 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications, 933 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications,
932 OnAccessibilityNotifications) 934 OnAccessibilityNotifications)
935 IPC_MESSAGE_HANDLER(ViewHostMsg_FrameTreeUpdated, OnFrameTreeUpdated)
933 // Have the super handle all other messages. 936 // Have the super handle all other messages.
934 IPC_MESSAGE_UNHANDLED( 937 IPC_MESSAGE_UNHANDLED(
935 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) 938 handled = RenderWidgetHostImpl::OnMessageReceived(msg))
936 IPC_END_MESSAGE_MAP_EX() 939 IPC_END_MESSAGE_MAP_EX()
937 940
938 if (!msg_is_ok) { 941 if (!msg_is_ok) {
939 // The message had a handler, but its de-serialization failed. 942 // The message had a handler, but its de-serialization failed.
940 // Kill the renderer. 943 // Kill the renderer.
941 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); 944 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH"));
942 GetProcess()->ReceivedBadMessage(); 945 GetProcess()->ReceivedBadMessage();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 FilterURL(policy, renderer_id, true, &validated_params.referrer.url); 1130 FilterURL(policy, renderer_id, true, &validated_params.referrer.url);
1128 for (std::vector<GURL>::iterator it(validated_params.redirects.begin()); 1131 for (std::vector<GURL>::iterator it(validated_params.redirects.begin());
1129 it != validated_params.redirects.end(); ++it) { 1132 it != validated_params.redirects.end(); ++it) {
1130 FilterURL(policy, renderer_id, false, &(*it)); 1133 FilterURL(policy, renderer_id, false, &(*it));
1131 } 1134 }
1132 FilterURL(policy, renderer_id, true, &validated_params.searchable_form_url); 1135 FilterURL(policy, renderer_id, true, &validated_params.searchable_form_url);
1133 FilterURL(policy, renderer_id, true, &validated_params.password_form.origin); 1136 FilterURL(policy, renderer_id, true, &validated_params.password_form.origin);
1134 FilterURL(policy, renderer_id, true, &validated_params.password_form.action); 1137 FilterURL(policy, renderer_id, true, &validated_params.password_form.action);
1135 1138
1136 delegate_->DidNavigate(this, validated_params); 1139 delegate_->DidNavigate(this, validated_params);
1140
1141 // For top level navigations, if there is no frame tree present for this
1142 // instance (for example when the window is first created), then create
1143 // an unnamed one with the proper frame id from the renderer.
1144 // This should be done after we called DidNavigate, since updating the frame
1145 // tree expects the render view being updated to be the active one.
1146 if (content::PageTransitionIsMainFrame(validated_params.transition)) {
1147 if (frame_tree_.empty()) {
1148 base::DictionaryValue tree;
1149 tree.SetString(content::kFrameTreeNodeNameKey, std::string());
1150 tree.SetInteger(content::kFrameTreeNodeIdKey, validated_params.frame_id);
1151 base::JSONWriter::Write(&tree, &frame_tree_);
1152 delegate_->DidUpdateFrameTree(this);
1153 }
1154 }
1137 } 1155 }
1138 1156
1139 void RenderViewHostImpl::OnMsgUpdateState(int32 page_id, 1157 void RenderViewHostImpl::OnMsgUpdateState(int32 page_id,
1140 const std::string& state) { 1158 const std::string& state) {
1141 delegate_->UpdateState(this, page_id, state); 1159 delegate_->UpdateState(this, page_id, state);
1142 } 1160 }
1143 1161
1144 void RenderViewHostImpl::OnMsgUpdateTitle( 1162 void RenderViewHostImpl::OnMsgUpdateTitle(
1145 int32 page_id, 1163 int32 page_id,
1146 const string16& title, 1164 const string16& title,
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 RejectMouseLockOrUnlockIfNecessary(); 1631 RejectMouseLockOrUnlockIfNecessary();
1614 // We need to notify the contents that its fullscreen state has changed. This 1632 // We need to notify the contents that its fullscreen state has changed. This
1615 // is done as part of the resize message. 1633 // is done as part of the resize message.
1616 WasResized(); 1634 WasResized();
1617 } 1635 }
1618 1636
1619 webkit_glue::WebPreferences RenderViewHostImpl::GetWebkitPreferences() { 1637 webkit_glue::WebPreferences RenderViewHostImpl::GetWebkitPreferences() {
1620 return delegate_->GetWebkitPrefs(); 1638 return delegate_->GetWebkitPrefs();
1621 } 1639 }
1622 1640
1641 void RenderViewHostImpl::UpdateFrameTree(
1642 int process_id,
1643 int route_id,
1644 const std::string& frame_tree) {
1645 frame_tree_ = frame_tree;
1646 Send(new ViewMsg_UpdateFrameTree(GetRoutingID(),
1647 process_id,
1648 route_id,
1649 frame_tree_));
1650 }
1651
1623 void RenderViewHostImpl::UpdateWebkitPreferences( 1652 void RenderViewHostImpl::UpdateWebkitPreferences(
1624 const webkit_glue::WebPreferences& prefs) { 1653 const webkit_glue::WebPreferences& prefs) {
1625 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); 1654 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs));
1626 } 1655 }
1627 1656
1628 void RenderViewHostImpl::ClearFocusedNode() { 1657 void RenderViewHostImpl::ClearFocusedNode() {
1629 Send(new ViewMsg_ClearFocusedNode(GetRoutingID())); 1658 Send(new ViewMsg_ClearFocusedNode(GetRoutingID()));
1630 } 1659 }
1631 1660
1632 void RenderViewHostImpl::SetZoomLevel(double level) { 1661 void RenderViewHostImpl::SetZoomLevel(double level) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 1877
1849 void RenderViewHostImpl::OnDomOperationResponse( 1878 void RenderViewHostImpl::OnDomOperationResponse(
1850 const std::string& json_string, int automation_id) { 1879 const std::string& json_string, int automation_id) {
1851 DomOperationNotificationDetails details(json_string, automation_id); 1880 DomOperationNotificationDetails details(json_string, automation_id);
1852 content::NotificationService::current()->Notify( 1881 content::NotificationService::current()->Notify(
1853 content::NOTIFICATION_DOM_OPERATION_RESPONSE, 1882 content::NOTIFICATION_DOM_OPERATION_RESPONSE,
1854 content::Source<RenderViewHost>(this), 1883 content::Source<RenderViewHost>(this),
1855 content::Details<DomOperationNotificationDetails>(&details)); 1884 content::Details<DomOperationNotificationDetails>(&details));
1856 } 1885 }
1857 1886
1887 void RenderViewHostImpl::OnFrameTreeUpdated(const std::string& frame_tree) {
1888 frame_tree_ = frame_tree;
1889 delegate_->DidUpdateFrameTree(this);
1890 }
1891
1858 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) { 1892 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) {
1859 is_swapped_out_ = is_swapped_out; 1893 is_swapped_out_ = is_swapped_out;
1860 1894
1861 // Whenever we change swap out state, we should not be waiting for 1895 // Whenever we change swap out state, we should not be waiting for
1862 // beforeunload or unload acks. We clear them here to be safe, since they 1896 // beforeunload or unload acks. We clear them here to be safe, since they
1863 // can cause navigations to be ignored in OnMsgNavigate. 1897 // can cause navigations to be ignored in OnMsgNavigate.
1864 is_waiting_for_beforeunload_ack_ = false; 1898 is_waiting_for_beforeunload_ack_ = false;
1865 is_waiting_for_unload_ack_ = false; 1899 is_waiting_for_unload_ack_ = false;
1866 } 1900 }
1867 1901
1868 void RenderViewHostImpl::ClearPowerSaveBlockers() { 1902 void RenderViewHostImpl::ClearPowerSaveBlockers() {
1869 STLDeleteValues(&power_save_blockers_); 1903 STLDeleteValues(&power_save_blockers_);
1870 } 1904 }
1871 1905
1872 } // namespace content 1906 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698