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

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

Issue 2310563002: Adds routed interface support between RenderFrameHost and RenderFrame (Closed)
Patch Set: nit Created 4 years, 3 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 <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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "content/browser/renderer_host/render_view_host_delegate_view.h" 46 #include "content/browser/renderer_host/render_view_host_delegate_view.h"
47 #include "content/browser/renderer_host/render_view_host_impl.h" 47 #include "content/browser/renderer_host/render_view_host_impl.h"
48 #include "content/browser/renderer_host/render_widget_host_delegate.h" 48 #include "content/browser/renderer_host/render_widget_host_delegate.h"
49 #include "content/browser/renderer_host/render_widget_host_impl.h" 49 #include "content/browser/renderer_host/render_widget_host_impl.h"
50 #include "content/browser/renderer_host/render_widget_host_view_base.h" 50 #include "content/browser/renderer_host/render_widget_host_view_base.h"
51 #include "content/browser/shared_worker/shared_worker_service_impl.h" 51 #include "content/browser/shared_worker/shared_worker_service_impl.h"
52 #include "content/browser/wake_lock/wake_lock_service_context.h" 52 #include "content/browser/wake_lock/wake_lock_service_context.h"
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"
57 #include "content/common/associated_interfaces.mojom.h"
56 #include "content/common/frame_messages.h" 58 #include "content/common/frame_messages.h"
57 #include "content/common/frame_owner_properties.h" 59 #include "content/common/frame_owner_properties.h"
58 #include "content/common/input_messages.h" 60 #include "content/common/input_messages.h"
59 #include "content/common/inter_process_time_ticks_converter.h" 61 #include "content/common/inter_process_time_ticks_converter.h"
60 #include "content/common/navigation_params.h" 62 #include "content/common/navigation_params.h"
61 #include "content/common/site_isolation_policy.h" 63 #include "content/common/site_isolation_policy.h"
62 #include "content/common/swapped_out_messages.h" 64 #include "content/common/swapped_out_messages.h"
63 #include "content/public/browser/ax_event_notification_details.h" 65 #include "content/public/browser/ax_event_notification_details.h"
64 #include "content/public/browser/browser_accessibility_state.h" 66 #include "content/public/browser/browser_accessibility_state.h"
65 #include "content/public/browser/browser_context.h" 67 #include "content/public/browser/browser_context.h"
(...skipping 14 matching lines...) Expand all
80 #include "content/public/common/file_chooser_params.h" 82 #include "content/public/common/file_chooser_params.h"
81 #include "content/public/common/isolated_world_ids.h" 83 #include "content/public/common/isolated_world_ids.h"
82 #include "content/public/common/mojo_shell_connection.h" 84 #include "content/public/common/mojo_shell_connection.h"
83 #include "content/public/common/url_constants.h" 85 #include "content/public/common/url_constants.h"
84 #include "content/public/common/url_utils.h" 86 #include "content/public/common/url_utils.h"
85 #include "device/generic_sensor/sensor_provider_impl.h" 87 #include "device/generic_sensor/sensor_provider_impl.h"
86 #include "device/geolocation/geolocation_service_context.h" 88 #include "device/geolocation/geolocation_service_context.h"
87 #include "device/vibration/vibration_manager_impl.h" 89 #include "device/vibration/vibration_manager_impl.h"
88 #include "media/mojo/interfaces/media_service.mojom.h" 90 #include "media/mojo/interfaces/media_service.mojom.h"
89 #include "media/mojo/interfaces/service_factory.mojom.h" 91 #include "media/mojo/interfaces/service_factory.mojom.h"
92 #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
90 #include "services/shell/public/cpp/connector.h" 93 #include "services/shell/public/cpp/connector.h"
91 #include "services/shell/public/cpp/interface_provider.h" 94 #include "services/shell/public/cpp/interface_provider.h"
92 #include "ui/accessibility/ax_tree.h" 95 #include "ui/accessibility/ax_tree.h"
93 #include "ui/accessibility/ax_tree_update.h" 96 #include "ui/accessibility/ax_tree_update.h"
94 #include "ui/gfx/geometry/quad_f.h" 97 #include "ui/gfx/geometry/quad_f.h"
95 #include "url/gurl.h" 98 #include "url/gurl.h"
96 99
97 #if defined(OS_ANDROID) 100 #if defined(OS_ANDROID)
98 #include "content/browser/mojo/interface_registrar_android.h" 101 #include "content/browser/mojo/interface_registrar_android.h"
99 #if defined(ENABLE_MOJO_CDM) 102 #if defined(ENABLE_MOJO_CDM)
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 } 496 }
494 497
495 shell::InterfaceRegistry* RenderFrameHostImpl::GetInterfaceRegistry() { 498 shell::InterfaceRegistry* RenderFrameHostImpl::GetInterfaceRegistry() {
496 return interface_registry_.get(); 499 return interface_registry_.get();
497 } 500 }
498 501
499 shell::InterfaceProvider* RenderFrameHostImpl::GetRemoteInterfaces() { 502 shell::InterfaceProvider* RenderFrameHostImpl::GetRemoteInterfaces() {
500 return remote_interfaces_.get(); 503 return remote_interfaces_.get();
501 } 504 }
502 505
506 AssociatedInterfaceProvider*
507 RenderFrameHostImpl::GetRemoteAssociatedInterfaces() {
508 if (!remote_associated_interfaces_) {
509 mojom::AssociatedInterfaceProviderAssociatedPtr remote_interfaces;
510 IPC::ChannelProxy* channel = GetProcess()->GetChannel();
511 if (channel) {
512 RenderProcessHostImpl* process =
513 static_cast<RenderProcessHostImpl*>(GetProcess());
514 process->GetRemoteRouteProvider()->GetRoute(
515 GetRoutingID(),
516 mojo::GetProxy(&remote_interfaces, channel->GetAssociatedGroup()));
517 } else {
518 // The channel may not be initialized in some tests environments. In this
519 // case we set up a dummy interface provider.
520 mojo::GetDummyProxyForTesting(&remote_interfaces);
521 }
522 remote_associated_interfaces_.reset(new AssociatedInterfaceProviderImpl(
523 std::move(remote_interfaces)));
524 }
525 return remote_associated_interfaces_.get();
526 }
527
503 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() { 528 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() {
504 // Works around the crashes seen in https://crbug.com/501863, where the 529 // Works around the crashes seen in https://crbug.com/501863, where the
505 // active WebContents from a browser iterator may contain a render frame 530 // active WebContents from a browser iterator may contain a render frame
506 // detached from the frame tree. This tries to find a RenderWidgetHost 531 // detached from the frame tree. This tries to find a RenderWidgetHost
507 // attached to an ancestor frame, and defaults to visibility hidden if 532 // attached to an ancestor frame, and defaults to visibility hidden if
508 // it fails. 533 // it fails.
509 // TODO(yfriedman, peter): Ideally this would never be called on an 534 // TODO(yfriedman, peter): Ideally this would never be called on an
510 // unattached frame and we could omit this check. See 535 // unattached frame and we could omit this check. See
511 // https://crbug.com/615867. 536 // https://crbug.com/615867.
512 RenderFrameHostImpl* frame = this; 537 RenderFrameHostImpl* frame = this;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 #if defined(USE_EXTERNAL_POPUP_MENU) 661 #if defined(USE_EXTERNAL_POPUP_MENU)
637 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) 662 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup)
638 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) 663 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup)
639 #endif 664 #endif
640 IPC_END_MESSAGE_MAP() 665 IPC_END_MESSAGE_MAP()
641 666
642 // No further actions here, since we may have been deleted. 667 // No further actions here, since we may have been deleted.
643 return handled; 668 return handled;
644 } 669 }
645 670
671 void RenderFrameHostImpl::OnAssociatedInterfaceRequest(
672 const std::string& interface_name,
673 mojo::ScopedInterfaceEndpointHandle handle) {
674 delegate_->OnAssociatedInterfaceRequest(
675 this, interface_name, std::move(handle));
676 }
677
646 void RenderFrameHostImpl::AccessibilitySetFocus(int object_id) { 678 void RenderFrameHostImpl::AccessibilitySetFocus(int object_id) {
647 Send(new AccessibilityMsg_SetFocus(routing_id_, object_id)); 679 Send(new AccessibilityMsg_SetFocus(routing_id_, object_id));
648 } 680 }
649 681
650 void RenderFrameHostImpl::AccessibilityDoDefaultAction(int object_id) { 682 void RenderFrameHostImpl::AccessibilityDoDefaultAction(int object_id) {
651 Send(new AccessibilityMsg_DoDefaultAction(routing_id_, object_id)); 683 Send(new AccessibilityMsg_DoDefaultAction(routing_id_, object_id));
652 } 684 }
653 685
654 void RenderFrameHostImpl::AccessibilityShowContextMenu(int acc_obj_id) { 686 void RenderFrameHostImpl::AccessibilityShowContextMenu(int acc_obj_id) {
655 Send(new AccessibilityMsg_ShowContextMenu(routing_id_, acc_obj_id)); 687 Send(new AccessibilityMsg_ShowContextMenu(routing_id_, acc_obj_id));
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 // reset. 1488 // reset.
1457 SetRenderFrameCreated(false); 1489 SetRenderFrameCreated(false);
1458 InvalidateMojoConnection(); 1490 InvalidateMojoConnection();
1459 1491
1460 // Execute any pending AX tree snapshot callbacks with an empty response, 1492 // Execute any pending AX tree snapshot callbacks with an empty response,
1461 // since we're never going to get a response from this renderer. 1493 // since we're never going to get a response from this renderer.
1462 for (const auto& iter : ax_tree_snapshot_callbacks_) 1494 for (const auto& iter : ax_tree_snapshot_callbacks_)
1463 iter.second.Run(ui::AXTreeUpdate()); 1495 iter.second.Run(ui::AXTreeUpdate());
1464 ax_tree_snapshot_callbacks_.clear(); 1496 ax_tree_snapshot_callbacks_.clear();
1465 1497
1498 // Ensure that future remote interface requests are associated with the new
1499 // process's channel.
1500 remote_associated_interfaces_.reset();
1501
1466 if (!is_active()) { 1502 if (!is_active()) {
1467 // If the process has died, we don't need to wait for the swap out ack from 1503 // If the process has died, we don't need to wait for the swap out ack from
1468 // this RenderFrame if it is pending deletion. Complete the swap out to 1504 // this RenderFrame if it is pending deletion. Complete the swap out to
1469 // destroy it. 1505 // destroy it.
1470 OnSwappedOut(); 1506 OnSwappedOut();
1471 } else { 1507 } else {
1472 // If this was the current pending or speculative RFH dying, cancel and 1508 // If this was the current pending or speculative RFH dying, cancel and
1473 // destroy it. 1509 // destroy it.
1474 frame_tree_node_->render_manager()->CancelPendingIfNecessary(this); 1510 frame_tree_node_->render_manager()->CancelPendingIfNecessary(this);
1475 } 1511 }
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 3092 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
3057 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 3093 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
3058 return web_bluetooth_service_.get(); 3094 return web_bluetooth_service_.get();
3059 } 3095 }
3060 3096
3061 void RenderFrameHostImpl::DeleteWebBluetoothService() { 3097 void RenderFrameHostImpl::DeleteWebBluetoothService() {
3062 web_bluetooth_service_.reset(); 3098 web_bluetooth_service_.reset();
3063 } 3099 }
3064 3100
3065 } // namespace content 3101 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698