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