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

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: Use WeakPtr inside FrameInputHandlerImpl, add 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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 // 1) Bypassing the "chrome-extension" scheme when chrome is built with the 1019 // 1) Bypassing the "chrome-extension" scheme when chrome is built with the
1018 // extensions support. 1020 // extensions support.
1019 // 2) Bypassing arbitrary scheme for testing purpose only in blink and in V8. 1021 // 2) Bypassing arbitrary scheme for testing purpose only in blink and in V8.
1020 // TODO(arthursonzogni): url::GetBypassingCSPScheme() is used instead of the 1022 // TODO(arthursonzogni): url::GetBypassingCSPScheme() is used instead of the
1021 // blink::SchemeRegistry. It contains 1) but not 2). 1023 // blink::SchemeRegistry. It contains 1) but not 2).
1022 const auto& bypassing_schemes = url::GetCSPBypassingSchemes(); 1024 const auto& bypassing_schemes = url::GetCSPBypassingSchemes();
1023 return std::find(bypassing_schemes.begin(), bypassing_schemes.end(), 1025 return std::find(bypassing_schemes.begin(), bypassing_schemes.end(),
1024 scheme) != bypassing_schemes.end(); 1026 scheme) != bypassing_schemes.end();
1025 } 1027 }
1026 1028
1029 mojom::FrameInputHandler* RenderFrameHostImpl::GetFrameInputHandler() {
1030 if (legacy_frame_input_handler_)
1031 return legacy_frame_input_handler_.get();
1032 return frame_input_handler_.get();
1033 }
1034
1027 bool RenderFrameHostImpl::CreateRenderFrame(int proxy_routing_id, 1035 bool RenderFrameHostImpl::CreateRenderFrame(int proxy_routing_id,
1028 int opener_routing_id, 1036 int opener_routing_id,
1029 int parent_routing_id, 1037 int parent_routing_id,
1030 int previous_sibling_routing_id) { 1038 int previous_sibling_routing_id) {
1031 TRACE_EVENT0("navigation", "RenderFrameHostImpl::CreateRenderFrame"); 1039 TRACE_EVENT0("navigation", "RenderFrameHostImpl::CreateRenderFrame");
1032 DCHECK(!IsRenderFrameLive()) << "Creating frame twice"; 1040 DCHECK(!IsRenderFrameLive()) << "Creating frame twice";
1033 1041
1034 // The process may (if we're sharing a process with another host that already 1042 // The process may (if we're sharing a process with another host that already
1035 // initialized it) or may not (we have our own process or the old process 1043 // initialized it) or may not (we have our own process or the old process
1036 // crashed) have been initialized. Calling Init multiple times will be 1044 // crashed) have been initialized. Calling Init multiple times will be
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 RenderFrameProxyHost* source_proxy) { 3026 RenderFrameProxyHost* source_proxy) {
3019 DCHECK(!source_proxy || 3027 DCHECK(!source_proxy ||
3020 (source_proxy->GetProcess()->GetID() == GetProcess()->GetID())); 3028 (source_proxy->GetProcess()->GetID() == GetProcess()->GetID()));
3021 int32_t source_proxy_routing_id = MSG_ROUTING_NONE; 3029 int32_t source_proxy_routing_id = MSG_ROUTING_NONE;
3022 if (source_proxy) 3030 if (source_proxy)
3023 source_proxy_routing_id = source_proxy->GetRoutingID(); 3031 source_proxy_routing_id = source_proxy->GetRoutingID();
3024 Send( 3032 Send(
3025 new FrameMsg_AdvanceFocus(GetRoutingID(), type, source_proxy_routing_id)); 3033 new FrameMsg_AdvanceFocus(GetRoutingID(), type, source_proxy_routing_id));
3026 } 3034 }
3027 3035
3028 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before,
3029 size_t after) {
3030 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after));
3031 }
3032
3033 void RenderFrameHostImpl::DeleteSurroundingText(size_t before, size_t after) {
3034 Send(new InputMsg_DeleteSurroundingText(routing_id_, before, after));
3035 }
3036
3037 void RenderFrameHostImpl::DeleteSurroundingTextInCodePoints(int before,
3038 int after) {
3039 Send(new InputMsg_DeleteSurroundingTextInCodePoints(routing_id_, before,
3040 after));
3041 }
3042
3043 void RenderFrameHostImpl::JavaScriptDialogClosed( 3036 void RenderFrameHostImpl::JavaScriptDialogClosed(
3044 IPC::Message* reply_msg, 3037 IPC::Message* reply_msg,
3045 bool success, 3038 bool success,
3046 const base::string16& user_input) { 3039 const base::string16& user_input) {
3047 GetProcess()->SetIgnoreInputEvents(false); 3040 GetProcess()->SetIgnoreInputEvents(false);
3048 3041
3049 SendJavaScriptDialogReply(reply_msg, success, user_input); 3042 SendJavaScriptDialogReply(reply_msg, success, user_input);
3050 3043
3051 // If executing as part of beforeunload event handling, there may have been 3044 // If executing as part of beforeunload event handling, there may have been
3052 // timers stopped in this frame or a frame up in the frame hierarchy. Restart 3045 // 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
3188 mojom::FrameFactoryPtr frame_factory; 3181 mojom::FrameFactoryPtr frame_factory;
3189 BindInterface(GetProcess(), &frame_factory); 3182 BindInterface(GetProcess(), &frame_factory);
3190 frame_factory->CreateFrame( 3183 frame_factory->CreateFrame(
3191 routing_id_, MakeRequest(&frame_), 3184 routing_id_, MakeRequest(&frame_),
3192 frame_host_interface_broker_binding_.CreateInterfacePtrAndBind()); 3185 frame_host_interface_broker_binding_.CreateInterfacePtrAndBind());
3193 3186
3194 service_manager::mojom::InterfaceProviderPtr remote_interfaces; 3187 service_manager::mojom::InterfaceProviderPtr remote_interfaces;
3195 frame_->GetInterfaceProvider(mojo::MakeRequest(&remote_interfaces)); 3188 frame_->GetInterfaceProvider(mojo::MakeRequest(&remote_interfaces));
3196 remote_interfaces_.reset(new service_manager::InterfaceProvider); 3189 remote_interfaces_.reset(new service_manager::InterfaceProvider);
3197 remote_interfaces_->Bind(std::move(remote_interfaces)); 3190 remote_interfaces_->Bind(std::move(remote_interfaces));
3191
3192 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
3193 switches::kMojoInputMessages)) {
3194 GetRemoteInterfaces()->GetInterface(&frame_input_handler_);
3195 } else {
3196 legacy_frame_input_handler_.reset(
3197 new LegacyIPCFrameInputHandler(this, routing_id_));
3198 }
3198 } 3199 }
3199 3200
3200 void RenderFrameHostImpl::InvalidateMojoConnection() { 3201 void RenderFrameHostImpl::InvalidateMojoConnection() {
3201 interface_registry_.reset(); 3202 interface_registry_.reset();
3202 3203
3203 frame_.reset(); 3204 frame_.reset();
3204 frame_host_interface_broker_binding_.Close(); 3205 frame_host_interface_broker_binding_.Close();
3205 frame_bindings_control_.reset(); 3206 frame_bindings_control_.reset();
3206 3207
3207 // Disconnect with ImageDownloader Mojo service in RenderFrame. 3208 // Disconnect with ImageDownloader Mojo service in RenderFrame.
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
3984 } 3985 }
3985 3986
3986 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 3987 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
3987 const std::string& interface_name, 3988 const std::string& interface_name,
3988 mojo::ScopedMessagePipeHandle pipe) { 3989 mojo::ScopedMessagePipeHandle pipe) {
3989 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 3990 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
3990 } 3991 }
3991 #endif 3992 #endif
3992 3993
3993 } // namespace content 3994 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698