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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_interface_registry_impl.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 Loading... |
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" |
| 93 #include "mojo/public/cpp/bindings/associated_interface_request.h" |
90 #include "services/shell/public/cpp/connector.h" | 94 #include "services/shell/public/cpp/connector.h" |
91 #include "services/shell/public/cpp/interface_provider.h" | 95 #include "services/shell/public/cpp/interface_provider.h" |
92 #include "ui/accessibility/ax_tree.h" | 96 #include "ui/accessibility/ax_tree.h" |
93 #include "ui/accessibility/ax_tree_update.h" | 97 #include "ui/accessibility/ax_tree_update.h" |
94 #include "ui/gfx/geometry/quad_f.h" | 98 #include "ui/gfx/geometry/quad_f.h" |
95 #include "url/gurl.h" | 99 #include "url/gurl.h" |
96 | 100 |
97 #if defined(OS_ANDROID) | 101 #if defined(OS_ANDROID) |
98 #include "content/browser/mojo/interface_registrar_android.h" | 102 #include "content/browser/mojo/interface_registrar_android.h" |
99 #if defined(ENABLE_MOJO_CDM) | 103 #if defined(ENABLE_MOJO_CDM) |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 } | 497 } |
494 | 498 |
495 shell::InterfaceRegistry* RenderFrameHostImpl::GetInterfaceRegistry() { | 499 shell::InterfaceRegistry* RenderFrameHostImpl::GetInterfaceRegistry() { |
496 return interface_registry_.get(); | 500 return interface_registry_.get(); |
497 } | 501 } |
498 | 502 |
499 shell::InterfaceProvider* RenderFrameHostImpl::GetRemoteInterfaces() { | 503 shell::InterfaceProvider* RenderFrameHostImpl::GetRemoteInterfaces() { |
500 return remote_interfaces_.get(); | 504 return remote_interfaces_.get(); |
501 } | 505 } |
502 | 506 |
| 507 AssociatedInterfaceRegistry* |
| 508 RenderFrameHostImpl::GetAssociatedInterfaceRegistry() { |
| 509 return &associated_interface_registry_; |
| 510 } |
| 511 |
| 512 AssociatedInterfaceProvider* |
| 513 RenderFrameHostImpl::GetRemoteAssociatedInterfaces() { |
| 514 if (!remote_associated_interfaces_) { |
| 515 mojom::AssociatedInterfaceProviderAssociatedPtr remote_interfaces; |
| 516 IPC::ChannelProxy* channel = GetProcess()->GetChannel(); |
| 517 if (channel) { |
| 518 RenderProcessHostImpl* process = |
| 519 static_cast<RenderProcessHostImpl*>(GetProcess()); |
| 520 process->GetRemoteRouteProvider()->GetRoute( |
| 521 GetRoutingID(), |
| 522 mojo::GetProxy(&remote_interfaces, channel->GetAssociatedGroup())); |
| 523 } else { |
| 524 // The channel may not be initialized in some tests environments. In this |
| 525 // case we set up a dummy interface provider. |
| 526 mojo::GetDummyProxyForTesting(&remote_interfaces); |
| 527 } |
| 528 remote_associated_interfaces_.reset(new AssociatedInterfaceProviderImpl( |
| 529 std::move(remote_interfaces))); |
| 530 } |
| 531 return remote_associated_interfaces_.get(); |
| 532 } |
| 533 |
503 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() { | 534 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() { |
504 // Works around the crashes seen in https://crbug.com/501863, where the | 535 // Works around the crashes seen in https://crbug.com/501863, where the |
505 // active WebContents from a browser iterator may contain a render frame | 536 // active WebContents from a browser iterator may contain a render frame |
506 // detached from the frame tree. This tries to find a RenderWidgetHost | 537 // detached from the frame tree. This tries to find a RenderWidgetHost |
507 // attached to an ancestor frame, and defaults to visibility hidden if | 538 // attached to an ancestor frame, and defaults to visibility hidden if |
508 // it fails. | 539 // it fails. |
509 // TODO(yfriedman, peter): Ideally this would never be called on an | 540 // TODO(yfriedman, peter): Ideally this would never be called on an |
510 // unattached frame and we could omit this check. See | 541 // unattached frame and we could omit this check. See |
511 // https://crbug.com/615867. | 542 // https://crbug.com/615867. |
512 RenderFrameHostImpl* frame = this; | 543 RenderFrameHostImpl* frame = this; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 #if defined(USE_EXTERNAL_POPUP_MENU) | 667 #if defined(USE_EXTERNAL_POPUP_MENU) |
637 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) | 668 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) |
638 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) | 669 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) |
639 #endif | 670 #endif |
640 IPC_END_MESSAGE_MAP() | 671 IPC_END_MESSAGE_MAP() |
641 | 672 |
642 // No further actions here, since we may have been deleted. | 673 // No further actions here, since we may have been deleted. |
643 return handled; | 674 return handled; |
644 } | 675 } |
645 | 676 |
| 677 void RenderFrameHostImpl::OnAssociatedInterfaceRequest( |
| 678 const std::string& interface_name, |
| 679 mojo::ScopedInterfaceEndpointHandle handle) { |
| 680 associated_interface_registry_.BindRequest(interface_name, std::move(handle)); |
| 681 } |
| 682 |
646 void RenderFrameHostImpl::AccessibilitySetFocus(int object_id) { | 683 void RenderFrameHostImpl::AccessibilitySetFocus(int object_id) { |
647 Send(new AccessibilityMsg_SetFocus(routing_id_, object_id)); | 684 Send(new AccessibilityMsg_SetFocus(routing_id_, object_id)); |
648 } | 685 } |
649 | 686 |
650 void RenderFrameHostImpl::AccessibilityDoDefaultAction(int object_id) { | 687 void RenderFrameHostImpl::AccessibilityDoDefaultAction(int object_id) { |
651 Send(new AccessibilityMsg_DoDefaultAction(routing_id_, object_id)); | 688 Send(new AccessibilityMsg_DoDefaultAction(routing_id_, object_id)); |
652 } | 689 } |
653 | 690 |
654 void RenderFrameHostImpl::AccessibilityShowContextMenu(int acc_obj_id) { | 691 void RenderFrameHostImpl::AccessibilityShowContextMenu(int acc_obj_id) { |
655 Send(new AccessibilityMsg_ShowContextMenu(routing_id_, acc_obj_id)); | 692 Send(new AccessibilityMsg_ShowContextMenu(routing_id_, acc_obj_id)); |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 // reset. | 1493 // reset. |
1457 SetRenderFrameCreated(false); | 1494 SetRenderFrameCreated(false); |
1458 InvalidateMojoConnection(); | 1495 InvalidateMojoConnection(); |
1459 | 1496 |
1460 // Execute any pending AX tree snapshot callbacks with an empty response, | 1497 // Execute any pending AX tree snapshot callbacks with an empty response, |
1461 // since we're never going to get a response from this renderer. | 1498 // since we're never going to get a response from this renderer. |
1462 for (const auto& iter : ax_tree_snapshot_callbacks_) | 1499 for (const auto& iter : ax_tree_snapshot_callbacks_) |
1463 iter.second.Run(ui::AXTreeUpdate()); | 1500 iter.second.Run(ui::AXTreeUpdate()); |
1464 ax_tree_snapshot_callbacks_.clear(); | 1501 ax_tree_snapshot_callbacks_.clear(); |
1465 | 1502 |
| 1503 // Ensure that future remote interface requests are associated with the new |
| 1504 // process's channel. |
| 1505 remote_associated_interfaces_.reset(); |
| 1506 |
1466 if (!is_active()) { | 1507 if (!is_active()) { |
1467 // If the process has died, we don't need to wait for the swap out ack from | 1508 // 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 | 1509 // this RenderFrame if it is pending deletion. Complete the swap out to |
1469 // destroy it. | 1510 // destroy it. |
1470 OnSwappedOut(); | 1511 OnSwappedOut(); |
1471 } else { | 1512 } else { |
1472 // If this was the current pending or speculative RFH dying, cancel and | 1513 // If this was the current pending or speculative RFH dying, cancel and |
1473 // destroy it. | 1514 // destroy it. |
1474 frame_tree_node_->render_manager()->CancelPendingIfNecessary(this); | 1515 frame_tree_node_->render_manager()->CancelPendingIfNecessary(this); |
1475 } | 1516 } |
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3096 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
3056 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3097 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
3057 return web_bluetooth_service_.get(); | 3098 return web_bluetooth_service_.get(); |
3058 } | 3099 } |
3059 | 3100 |
3060 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3101 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
3061 web_bluetooth_service_.reset(); | 3102 web_bluetooth_service_.reset(); |
3062 } | 3103 } |
3063 | 3104 |
3064 } // namespace content | 3105 } // namespace content |
OLD | NEW |