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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2884243003: Add a mojo channel for frame messages. (Closed)
Patch Set: Fix dcheng's initial comments Created 3 years, 7 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
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" 23 #include "content/browser/bluetooth/web_bluetooth_service_impl.h"
24 #include "content/browser/browser_main_loop.h" 24 #include "content/browser/browser_main_loop.h"
25 #include "content/browser/child_process_security_policy_impl.h" 25 #include "content/browser/child_process_security_policy_impl.h"
26 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 26 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
27 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" 27 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
28 #include "content/browser/download/mhtml_generation_manager.h" 28 #include "content/browser/download/mhtml_generation_manager.h"
29 #include "content/browser/frame_host/cross_process_frame_connector.h" 29 #include "content/browser/frame_host/cross_process_frame_connector.h"
30 #include "content/browser/frame_host/debug_urls.h" 30 #include "content/browser/frame_host/debug_urls.h"
31 #include "content/browser/frame_host/frame_tree.h" 31 #include "content/browser/frame_host/frame_tree.h"
32 #include "content/browser/frame_host/frame_tree_node.h" 32 #include "content/browser/frame_host/frame_tree_node.h"
33 #include "content/browser/frame_host/input/legacy_ipc_frame_input_handler.h"
33 #include "content/browser/frame_host/navigation_entry_impl.h" 34 #include "content/browser/frame_host/navigation_entry_impl.h"
34 #include "content/browser/frame_host/navigation_handle_impl.h" 35 #include "content/browser/frame_host/navigation_handle_impl.h"
35 #include "content/browser/frame_host/navigation_request.h" 36 #include "content/browser/frame_host/navigation_request.h"
36 #include "content/browser/frame_host/navigator.h" 37 #include "content/browser/frame_host/navigator.h"
37 #include "content/browser/frame_host/navigator_impl.h" 38 #include "content/browser/frame_host/navigator_impl.h"
38 #include "content/browser/frame_host/render_frame_host_delegate.h" 39 #include "content/browser/frame_host/render_frame_host_delegate.h"
39 #include "content/browser/frame_host/render_frame_proxy_host.h" 40 #include "content/browser/frame_host/render_frame_proxy_host.h"
40 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 41 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
41 #include "content/browser/installedapp/installed_app_provider_impl_default.h" 42 #include "content/browser/installedapp/installed_app_provider_impl_default.h"
42 #include "content/browser/keyboard_lock/keyboard_lock_service_impl.h" 43 #include "content/browser/keyboard_lock/keyboard_lock_service_impl.h"
(...skipping 19 matching lines...) Expand all
62 #include "content/browser/webui/url_data_manager_backend.h" 63 #include "content/browser/webui/url_data_manager_backend.h"
63 #include "content/browser/webui/web_ui_controller_factory_registry.h" 64 #include "content/browser/webui/web_ui_controller_factory_registry.h"
64 #include "content/browser/webui/web_ui_url_loader_factory.h" 65 #include "content/browser/webui/web_ui_url_loader_factory.h"
65 #include "content/common/accessibility_messages.h" 66 #include "content/common/accessibility_messages.h"
66 #include "content/common/associated_interface_provider_impl.h" 67 #include "content/common/associated_interface_provider_impl.h"
67 #include "content/common/associated_interface_registry_impl.h" 68 #include "content/common/associated_interface_registry_impl.h"
68 #include "content/common/associated_interfaces.mojom.h" 69 #include "content/common/associated_interfaces.mojom.h"
69 #include "content/common/content_security_policy/content_security_policy.h" 70 #include "content/common/content_security_policy/content_security_policy.h"
70 #include "content/common/frame_messages.h" 71 #include "content/common/frame_messages.h"
71 #include "content/common/frame_owner_properties.h" 72 #include "content/common/frame_owner_properties.h"
73 #include "content/common/input/input_handler.mojom.h"
72 #include "content/common/input_messages.h" 74 #include "content/common/input_messages.h"
73 #include "content/common/inter_process_time_ticks_converter.h" 75 #include "content/common/inter_process_time_ticks_converter.h"
74 #include "content/common/navigation_params.h" 76 #include "content/common/navigation_params.h"
75 #include "content/common/render_message_filter.mojom.h" 77 #include "content/common/render_message_filter.mojom.h"
76 #include "content/common/renderer.mojom.h" 78 #include "content/common/renderer.mojom.h"
77 #include "content/common/site_isolation_policy.h" 79 #include "content/common/site_isolation_policy.h"
78 #include "content/common/swapped_out_messages.h" 80 #include "content/common/swapped_out_messages.h"
79 #include "content/public/browser/ax_event_notification_details.h" 81 #include "content/public/browser/ax_event_notification_details.h"
80 #include "content/public/browser/browser_accessibility_state.h" 82 #include "content/public/browser/browser_accessibility_state.h"
81 #include "content/public/browser/browser_context.h" 83 #include "content/public/browser/browser_context.h"
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 // 1) Bypassing the "chrome-extension" scheme when chrome is built with the 983 // 1) Bypassing the "chrome-extension" scheme when chrome is built with the
982 // extensions support. 984 // extensions support.
983 // 2) Bypassing arbitrary scheme for testing purpose only in blink and in V8. 985 // 2) Bypassing arbitrary scheme for testing purpose only in blink and in V8.
984 // TODO(arthursonzogni): url::GetBypassingCSPScheme() is used instead of the 986 // TODO(arthursonzogni): url::GetBypassingCSPScheme() is used instead of the
985 // blink::SchemeRegistry. It contains 1) but not 2). 987 // blink::SchemeRegistry. It contains 1) but not 2).
986 const auto& bypassing_schemes = url::GetCSPBypassingSchemes(); 988 const auto& bypassing_schemes = url::GetCSPBypassingSchemes();
987 return std::find(bypassing_schemes.begin(), bypassing_schemes.end(), 989 return std::find(bypassing_schemes.begin(), bypassing_schemes.end(),
988 scheme) != bypassing_schemes.end(); 990 scheme) != bypassing_schemes.end();
989 } 991 }
990 992
993 mojom::FrameInputHandler* RenderFrameHostImpl::GetFrameInputHandler() {
994 if (legacy_frame_input_handler_.get())
dcheng 2017/05/19 14:59:33 Nit: no.get() in conditional tests
dtapuska 2017/05/23 16:01:18 Done.
995 return legacy_frame_input_handler_.get();
996 return frame_input_handler_.get();
997 }
998
991 bool RenderFrameHostImpl::CreateRenderFrame(int proxy_routing_id, 999 bool RenderFrameHostImpl::CreateRenderFrame(int proxy_routing_id,
992 int opener_routing_id, 1000 int opener_routing_id,
993 int parent_routing_id, 1001 int parent_routing_id,
994 int previous_sibling_routing_id) { 1002 int previous_sibling_routing_id) {
995 TRACE_EVENT0("navigation", "RenderFrameHostImpl::CreateRenderFrame"); 1003 TRACE_EVENT0("navigation", "RenderFrameHostImpl::CreateRenderFrame");
996 DCHECK(!IsRenderFrameLive()) << "Creating frame twice"; 1004 DCHECK(!IsRenderFrameLive()) << "Creating frame twice";
997 1005
998 // The process may (if we're sharing a process with another host that already 1006 // The process may (if we're sharing a process with another host that already
999 // initialized it) or may not (we have our own process or the old process 1007 // initialized it) or may not (we have our own process or the old process
1000 // crashed) have been initialized. Calling Init multiple times will be 1008 // crashed) have been initialized. Calling Init multiple times will be
(...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after
2976 RenderFrameProxyHost* source_proxy) { 2984 RenderFrameProxyHost* source_proxy) {
2977 DCHECK(!source_proxy || 2985 DCHECK(!source_proxy ||
2978 (source_proxy->GetProcess()->GetID() == GetProcess()->GetID())); 2986 (source_proxy->GetProcess()->GetID() == GetProcess()->GetID()));
2979 int32_t source_proxy_routing_id = MSG_ROUTING_NONE; 2987 int32_t source_proxy_routing_id = MSG_ROUTING_NONE;
2980 if (source_proxy) 2988 if (source_proxy)
2981 source_proxy_routing_id = source_proxy->GetRoutingID(); 2989 source_proxy_routing_id = source_proxy->GetRoutingID();
2982 Send( 2990 Send(
2983 new FrameMsg_AdvanceFocus(GetRoutingID(), type, source_proxy_routing_id)); 2991 new FrameMsg_AdvanceFocus(GetRoutingID(), type, source_proxy_routing_id));
2984 } 2992 }
2985 2993
2986 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before,
2987 size_t after) {
2988 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after));
2989 }
2990
2991 void RenderFrameHostImpl::DeleteSurroundingText(size_t before, size_t after) {
2992 Send(new InputMsg_DeleteSurroundingText(routing_id_, before, after));
2993 }
2994
2995 void RenderFrameHostImpl::DeleteSurroundingTextInCodePoints(int before,
2996 int after) {
2997 Send(new InputMsg_DeleteSurroundingTextInCodePoints(routing_id_, before,
2998 after));
2999 }
3000
3001 void RenderFrameHostImpl::JavaScriptDialogClosed( 2994 void RenderFrameHostImpl::JavaScriptDialogClosed(
3002 IPC::Message* reply_msg, 2995 IPC::Message* reply_msg,
3003 bool success, 2996 bool success,
3004 const base::string16& user_input) { 2997 const base::string16& user_input) {
3005 GetProcess()->SetIgnoreInputEvents(false); 2998 GetProcess()->SetIgnoreInputEvents(false);
3006 2999
3007 SendJavaScriptDialogReply(reply_msg, success, user_input); 3000 SendJavaScriptDialogReply(reply_msg, success, user_input);
3008 3001
3009 // If executing as part of beforeunload event handling, there may have been 3002 // If executing as part of beforeunload event handling, there may have been
3010 // timers stopped in this frame or a frame up in the frame hierarchy. Restart 3003 // timers stopped in this frame or a frame up in the frame hierarchy. Restart
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
3145 mojom::FrameFactoryPtr frame_factory; 3138 mojom::FrameFactoryPtr frame_factory;
3146 BindInterface(GetProcess(), &frame_factory); 3139 BindInterface(GetProcess(), &frame_factory);
3147 frame_factory->CreateFrame( 3140 frame_factory->CreateFrame(
3148 routing_id_, MakeRequest(&frame_), 3141 routing_id_, MakeRequest(&frame_),
3149 frame_host_interface_broker_binding_.CreateInterfacePtrAndBind()); 3142 frame_host_interface_broker_binding_.CreateInterfacePtrAndBind());
3150 3143
3151 service_manager::mojom::InterfaceProviderPtr remote_interfaces; 3144 service_manager::mojom::InterfaceProviderPtr remote_interfaces;
3152 frame_->GetInterfaceProvider(mojo::MakeRequest(&remote_interfaces)); 3145 frame_->GetInterfaceProvider(mojo::MakeRequest(&remote_interfaces));
3153 remote_interfaces_.reset(new service_manager::InterfaceProvider); 3146 remote_interfaces_.reset(new service_manager::InterfaceProvider);
3154 remote_interfaces_->Bind(std::move(remote_interfaces)); 3147 remote_interfaces_->Bind(std::move(remote_interfaces));
3148
3149 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
3150 switches::kMojoInputMessages)) {
3151 GetRemoteInterfaces()->GetInterface(&frame_input_handler_);
3152 } else {
3153 legacy_frame_input_handler_.reset(
3154 new LegacyIPCFrameInputHandler(this, routing_id_));
3155 }
3155 } 3156 }
3156 3157
3157 void RenderFrameHostImpl::InvalidateMojoConnection() { 3158 void RenderFrameHostImpl::InvalidateMojoConnection() {
3158 interface_registry_.reset(); 3159 interface_registry_.reset();
3159 3160
3160 frame_.reset(); 3161 frame_.reset();
3161 frame_host_interface_broker_binding_.Close(); 3162 frame_host_interface_broker_binding_.Close();
3162 frame_bindings_control_.reset(); 3163 frame_bindings_control_.reset();
3163 3164
3164 // Disconnect with ImageDownloader Mojo service in RenderFrame. 3165 // Disconnect with ImageDownloader Mojo service in RenderFrame.
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
3934 } 3935 }
3935 3936
3936 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 3937 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
3937 const std::string& interface_name, 3938 const std::string& interface_name,
3938 mojo::ScopedMessagePipeHandle pipe) { 3939 mojo::ScopedMessagePipeHandle pipe) {
3939 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 3940 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
3940 } 3941 }
3941 #endif 3942 #endif
3942 3943
3943 } // namespace content 3944 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698