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

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 presubmit warning I ignored Created 3 years, 6 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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 // 1) Bypassing the "chrome-extension" scheme when chrome is built with the 1030 // 1) Bypassing the "chrome-extension" scheme when chrome is built with the
1029 // extensions support. 1031 // extensions support.
1030 // 2) Bypassing arbitrary scheme for testing purpose only in blink and in V8. 1032 // 2) Bypassing arbitrary scheme for testing purpose only in blink and in V8.
1031 // TODO(arthursonzogni): url::GetBypassingCSPScheme() is used instead of the 1033 // TODO(arthursonzogni): url::GetBypassingCSPScheme() is used instead of the
1032 // blink::SchemeRegistry. It contains 1) but not 2). 1034 // blink::SchemeRegistry. It contains 1) but not 2).
1033 const auto& bypassing_schemes = url::GetCSPBypassingSchemes(); 1035 const auto& bypassing_schemes = url::GetCSPBypassingSchemes();
1034 return std::find(bypassing_schemes.begin(), bypassing_schemes.end(), 1036 return std::find(bypassing_schemes.begin(), bypassing_schemes.end(),
1035 scheme) != bypassing_schemes.end(); 1037 scheme) != bypassing_schemes.end();
1036 } 1038 }
1037 1039
1040 mojom::FrameInputHandler* RenderFrameHostImpl::GetFrameInputHandler() {
1041 if (legacy_frame_input_handler_)
1042 return legacy_frame_input_handler_.get();
1043 return frame_input_handler_.get();
1044 }
1045
1038 bool RenderFrameHostImpl::CreateRenderFrame(int proxy_routing_id, 1046 bool RenderFrameHostImpl::CreateRenderFrame(int proxy_routing_id,
1039 int opener_routing_id, 1047 int opener_routing_id,
1040 int parent_routing_id, 1048 int parent_routing_id,
1041 int previous_sibling_routing_id) { 1049 int previous_sibling_routing_id) {
1042 TRACE_EVENT0("navigation", "RenderFrameHostImpl::CreateRenderFrame"); 1050 TRACE_EVENT0("navigation", "RenderFrameHostImpl::CreateRenderFrame");
1043 DCHECK(!IsRenderFrameLive()) << "Creating frame twice"; 1051 DCHECK(!IsRenderFrameLive()) << "Creating frame twice";
1044 1052
1045 // The process may (if we're sharing a process with another host that already 1053 // The process may (if we're sharing a process with another host that already
1046 // initialized it) or may not (we have our own process or the old process 1054 // initialized it) or may not (we have our own process or the old process
1047 // crashed) have been initialized. Calling Init multiple times will be 1055 // crashed) have been initialized. Calling Init multiple times will be
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after
3042 RenderFrameProxyHost* source_proxy) { 3050 RenderFrameProxyHost* source_proxy) {
3043 DCHECK(!source_proxy || 3051 DCHECK(!source_proxy ||
3044 (source_proxy->GetProcess()->GetID() == GetProcess()->GetID())); 3052 (source_proxy->GetProcess()->GetID() == GetProcess()->GetID()));
3045 int32_t source_proxy_routing_id = MSG_ROUTING_NONE; 3053 int32_t source_proxy_routing_id = MSG_ROUTING_NONE;
3046 if (source_proxy) 3054 if (source_proxy)
3047 source_proxy_routing_id = source_proxy->GetRoutingID(); 3055 source_proxy_routing_id = source_proxy->GetRoutingID();
3048 Send( 3056 Send(
3049 new FrameMsg_AdvanceFocus(GetRoutingID(), type, source_proxy_routing_id)); 3057 new FrameMsg_AdvanceFocus(GetRoutingID(), type, source_proxy_routing_id));
3050 } 3058 }
3051 3059
3052 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before,
3053 size_t after) {
3054 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after));
3055 }
3056
3057 void RenderFrameHostImpl::DeleteSurroundingText(size_t before, size_t after) {
3058 Send(new InputMsg_DeleteSurroundingText(routing_id_, before, after));
3059 }
3060
3061 void RenderFrameHostImpl::DeleteSurroundingTextInCodePoints(int before,
3062 int after) {
3063 Send(new InputMsg_DeleteSurroundingTextInCodePoints(routing_id_, before,
3064 after));
3065 }
3066
3067 void RenderFrameHostImpl::JavaScriptDialogClosed( 3060 void RenderFrameHostImpl::JavaScriptDialogClosed(
3068 IPC::Message* reply_msg, 3061 IPC::Message* reply_msg,
3069 bool success, 3062 bool success,
3070 const base::string16& user_input) { 3063 const base::string16& user_input) {
3071 GetProcess()->SetIgnoreInputEvents(false); 3064 GetProcess()->SetIgnoreInputEvents(false);
3072 3065
3073 SendJavaScriptDialogReply(reply_msg, success, user_input); 3066 SendJavaScriptDialogReply(reply_msg, success, user_input);
3074 3067
3075 // If executing as part of beforeunload event handling, there may have been 3068 // If executing as part of beforeunload event handling, there may have been
3076 // timers stopped in this frame or a frame up in the frame hierarchy. Restart 3069 // timers stopped in this frame or a frame up in the frame hierarchy. Restart
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3212 mojom::FrameFactoryPtr frame_factory; 3205 mojom::FrameFactoryPtr frame_factory;
3213 BindInterface(GetProcess(), &frame_factory); 3206 BindInterface(GetProcess(), &frame_factory);
3214 frame_factory->CreateFrame( 3207 frame_factory->CreateFrame(
3215 routing_id_, MakeRequest(&frame_), 3208 routing_id_, MakeRequest(&frame_),
3216 frame_host_interface_broker_binding_.CreateInterfacePtrAndBind()); 3209 frame_host_interface_broker_binding_.CreateInterfacePtrAndBind());
3217 3210
3218 service_manager::mojom::InterfaceProviderPtr remote_interfaces; 3211 service_manager::mojom::InterfaceProviderPtr remote_interfaces;
3219 frame_->GetInterfaceProvider(mojo::MakeRequest(&remote_interfaces)); 3212 frame_->GetInterfaceProvider(mojo::MakeRequest(&remote_interfaces));
3220 remote_interfaces_.reset(new service_manager::InterfaceProvider); 3213 remote_interfaces_.reset(new service_manager::InterfaceProvider);
3221 remote_interfaces_->Bind(std::move(remote_interfaces)); 3214 remote_interfaces_->Bind(std::move(remote_interfaces));
3215
3216 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
3217 switches::kMojoInputMessages)) {
3218 GetRemoteInterfaces()->GetInterface(&frame_input_handler_);
3219 } else {
3220 legacy_frame_input_handler_.reset(
3221 new LegacyIPCFrameInputHandler(this, routing_id_));
3222 }
3222 } 3223 }
3223 3224
3224 void RenderFrameHostImpl::InvalidateMojoConnection() { 3225 void RenderFrameHostImpl::InvalidateMojoConnection() {
3225 interface_registry_.reset(); 3226 interface_registry_.reset();
3226 3227
3227 frame_.reset(); 3228 frame_.reset();
3228 frame_host_interface_broker_binding_.Close(); 3229 frame_host_interface_broker_binding_.Close();
3229 frame_bindings_control_.reset(); 3230 frame_bindings_control_.reset();
3230 3231
3231 // Disconnect with ImageDownloader Mojo service in RenderFrame. 3232 // Disconnect with ImageDownloader Mojo service in RenderFrame.
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
4071 } 4072 }
4072 4073
4073 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 4074 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
4074 const std::string& interface_name, 4075 const std::string& interface_name,
4075 mojo::ScopedMessagePipeHandle pipe) { 4076 mojo::ScopedMessagePipeHandle pipe) {
4076 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 4077 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
4077 } 4078 }
4078 #endif 4079 #endif
4079 4080
4080 } // namespace content 4081 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698