OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "content/browser/websockets/websocket_manager.h" | 52 #include "content/browser/websockets/websocket_manager.h" |
53 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 53 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
54 #include "content/common/accessibility_messages.h" | 54 #include "content/common/accessibility_messages.h" |
55 #include "content/common/associated_interface_provider_impl.h" | 55 #include "content/common/associated_interface_provider_impl.h" |
56 #include "content/common/associated_interfaces.mojom.h" | 56 #include "content/common/associated_interfaces.mojom.h" |
57 #include "content/common/frame_messages.h" | 57 #include "content/common/frame_messages.h" |
58 #include "content/common/frame_owner_properties.h" | 58 #include "content/common/frame_owner_properties.h" |
59 #include "content/common/input_messages.h" | 59 #include "content/common/input_messages.h" |
60 #include "content/common/inter_process_time_ticks_converter.h" | 60 #include "content/common/inter_process_time_ticks_converter.h" |
61 #include "content/common/navigation_params.h" | 61 #include "content/common/navigation_params.h" |
| 62 #include "content/common/renderer.mojom.h" |
62 #include "content/common/site_isolation_policy.h" | 63 #include "content/common/site_isolation_policy.h" |
63 #include "content/common/swapped_out_messages.h" | 64 #include "content/common/swapped_out_messages.h" |
64 #include "content/public/browser/ax_event_notification_details.h" | 65 #include "content/public/browser/ax_event_notification_details.h" |
65 #include "content/public/browser/browser_accessibility_state.h" | 66 #include "content/public/browser/browser_accessibility_state.h" |
66 #include "content/public/browser/browser_context.h" | 67 #include "content/public/browser/browser_context.h" |
67 #include "content/public/browser/browser_plugin_guest_manager.h" | 68 #include "content/public/browser/browser_plugin_guest_manager.h" |
68 #include "content/public/browser/browser_thread.h" | 69 #include "content/public/browser/browser_thread.h" |
69 #include "content/public/browser/content_browser_client.h" | 70 #include "content/public/browser/content_browser_client.h" |
70 #include "content/public/browser/permission_manager.h" | 71 #include "content/public/browser/permission_manager.h" |
71 #include "content/public/browser/permission_type.h" | 72 #include "content/public/browser/permission_type.h" |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 | 842 |
842 // The process may (if we're sharing a process with another host that already | 843 // The process may (if we're sharing a process with another host that already |
843 // initialized it) or may not (we have our own process or the old process | 844 // initialized it) or may not (we have our own process or the old process |
844 // crashed) have been initialized. Calling Init multiple times will be | 845 // crashed) have been initialized. Calling Init multiple times will be |
845 // ignored, so this is safe. | 846 // ignored, so this is safe. |
846 if (!GetProcess()->Init()) | 847 if (!GetProcess()->Init()) |
847 return false; | 848 return false; |
848 | 849 |
849 DCHECK(GetProcess()->HasConnection()); | 850 DCHECK(GetProcess()->HasConnection()); |
850 | 851 |
851 FrameMsg_NewFrame_Params params; | 852 mojom::CreateFrameParamsPtr params = mojom::CreateFrameParams::New(); |
852 params.routing_id = routing_id_; | 853 params->routing_id = routing_id_; |
853 params.proxy_routing_id = proxy_routing_id; | 854 params->proxy_routing_id = proxy_routing_id; |
854 params.opener_routing_id = opener_routing_id; | 855 params->opener_routing_id = opener_routing_id; |
855 params.parent_routing_id = parent_routing_id; | 856 params->parent_routing_id = parent_routing_id; |
856 params.previous_sibling_routing_id = previous_sibling_routing_id; | 857 params->previous_sibling_routing_id = previous_sibling_routing_id; |
857 params.replication_state = frame_tree_node()->current_replication_state(); | 858 params->replication_state = frame_tree_node()->current_replication_state(); |
858 | 859 |
859 // Normally, the replication state contains effective sandbox flags, | 860 // Normally, the replication state contains effective sandbox flags, |
860 // excluding flags that were updated but have not taken effect. However, a | 861 // excluding flags that were updated but have not taken effect. However, a |
861 // new RenderFrame should use the pending sandbox flags, since it is being | 862 // new RenderFrame should use the pending sandbox flags, since it is being |
862 // created as part of the navigation that will commit these flags. (I.e., the | 863 // created as part of the navigation that will commit these flags. (I.e., the |
863 // RenderFrame needs to know the flags to use when initializing the new | 864 // RenderFrame needs to know the flags to use when initializing the new |
864 // document once it commits). | 865 // document once it commits). |
865 params.replication_state.sandbox_flags = | 866 params->replication_state.sandbox_flags = |
866 frame_tree_node()->pending_sandbox_flags(); | 867 frame_tree_node()->pending_sandbox_flags(); |
867 | 868 |
868 params.frame_owner_properties = | 869 params->frame_owner_properties = |
869 FrameOwnerProperties(frame_tree_node()->frame_owner_properties()); | 870 FrameOwnerProperties(frame_tree_node()->frame_owner_properties()); |
870 | 871 |
| 872 params->widget_params = mojom::CreateFrameWidgetParams::New(); |
871 if (render_widget_host_) { | 873 if (render_widget_host_) { |
872 params.widget_params.routing_id = render_widget_host_->GetRoutingID(); | 874 params->widget_params->routing_id = render_widget_host_->GetRoutingID(); |
873 params.widget_params.hidden = render_widget_host_->is_hidden(); | 875 params->widget_params->hidden = render_widget_host_->is_hidden(); |
874 } else { | 876 } else { |
875 // MSG_ROUTING_NONE will prevent a new RenderWidget from being created in | 877 // MSG_ROUTING_NONE will prevent a new RenderWidget from being created in |
876 // the renderer process. | 878 // the renderer process. |
877 params.widget_params.routing_id = MSG_ROUTING_NONE; | 879 params->widget_params->routing_id = MSG_ROUTING_NONE; |
878 params.widget_params.hidden = true; | 880 params->widget_params->hidden = true; |
879 } | 881 } |
880 | 882 |
881 Send(new FrameMsg_NewFrame(params)); | 883 static_cast<RenderProcessHostImpl*>(GetProcess())->GetRendererInterface() |
| 884 ->CreateFrame(std::move(params)); |
882 | 885 |
883 // The RenderWidgetHost takes ownership of its view. It is tied to the | 886 // The RenderWidgetHost takes ownership of its view. It is tied to the |
884 // lifetime of the current RenderProcessHost for this RenderFrameHost. | 887 // lifetime of the current RenderProcessHost for this RenderFrameHost. |
885 // TODO(avi): This will need to change to initialize a | 888 // TODO(avi): This will need to change to initialize a |
886 // RenderWidgetHostViewAura for the main frame once RenderViewHostImpl has-a | 889 // RenderWidgetHostViewAura for the main frame once RenderViewHostImpl has-a |
887 // RenderWidgetHostImpl. https://crbug.com/545684 | 890 // RenderWidgetHostImpl. https://crbug.com/545684 |
888 if (parent_routing_id != MSG_ROUTING_NONE && render_widget_host_) { | 891 if (parent_routing_id != MSG_ROUTING_NONE && render_widget_host_) { |
889 RenderWidgetHostView* rwhv = | 892 RenderWidgetHostView* rwhv = |
890 new RenderWidgetHostViewChildFrame(render_widget_host_); | 893 new RenderWidgetHostViewChildFrame(render_widget_host_); |
891 rwhv->Hide(); | 894 rwhv->Hide(); |
892 } | 895 } |
893 | 896 |
894 if (proxy_routing_id != MSG_ROUTING_NONE) { | 897 if (proxy_routing_id != MSG_ROUTING_NONE) { |
895 RenderFrameProxyHost* proxy = RenderFrameProxyHost::FromID( | 898 RenderFrameProxyHost* proxy = RenderFrameProxyHost::FromID( |
896 GetProcess()->GetID(), proxy_routing_id); | 899 GetProcess()->GetID(), proxy_routing_id); |
897 // We have also created a RenderFrameProxy in FrameMsg_NewFrame above, so | 900 // We have also created a RenderFrameProxy in CreateFrame above, so |
898 // remember that. | 901 // remember that. |
899 proxy->set_render_frame_proxy_created(true); | 902 proxy->set_render_frame_proxy_created(true); |
900 } | 903 } |
901 | 904 |
902 // The renderer now has a RenderFrame for this RenderFrameHost. Note that | 905 // The renderer now has a RenderFrame for this RenderFrameHost. Note that |
903 // this path is only used for out-of-process iframes. Main frame RenderFrames | 906 // this path is only used for out-of-process iframes. Main frame RenderFrames |
904 // are created with their RenderView, and same-site iframes are created at the | 907 // are created with their RenderView, and same-site iframes are created at the |
905 // time of OnCreateChildFrame. | 908 // time of OnCreateChildFrame. |
906 SetRenderFrameCreated(true); | 909 SetRenderFrameCreated(true); |
907 | 910 |
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3084 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3087 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
3085 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3088 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
3086 return web_bluetooth_service_.get(); | 3089 return web_bluetooth_service_.get(); |
3087 } | 3090 } |
3088 | 3091 |
3089 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3092 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
3090 web_bluetooth_service_.reset(); | 3093 web_bluetooth_service_.reset(); |
3091 } | 3094 } |
3092 | 3095 |
3093 } // namespace content | 3096 } // namespace content |
OLD | NEW |