| 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 remote_associated_interfaces_.reset(new AssociatedInterfaceProviderImpl( |
| 516 *GetProcess()->GetChannel()->GetAssociatedGroup(), |
| 517 GetProcess()->GetRemoteRouteProvider(), GetRoutingID())); |
| 518 } |
| 519 return remote_associated_interfaces_.get(); |
| 520 } |
| 521 |
| 503 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() { | 522 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() { |
| 504 // Works around the crashes seen in https://crbug.com/501863, where the | 523 // Works around the crashes seen in https://crbug.com/501863, where the |
| 505 // active WebContents from a browser iterator may contain a render frame | 524 // active WebContents from a browser iterator may contain a render frame |
| 506 // detached from the frame tree. This tries to find a RenderWidgetHost | 525 // detached from the frame tree. This tries to find a RenderWidgetHost |
| 507 // attached to an ancestor frame, and defaults to visibility hidden if | 526 // attached to an ancestor frame, and defaults to visibility hidden if |
| 508 // it fails. | 527 // it fails. |
| 509 // TODO(yfriedman, peter): Ideally this would never be called on an | 528 // TODO(yfriedman, peter): Ideally this would never be called on an |
| 510 // unattached frame and we could omit this check. See | 529 // unattached frame and we could omit this check. See |
| 511 // https://crbug.com/615867. | 530 // https://crbug.com/615867. |
| 512 RenderFrameHostImpl* frame = this; | 531 RenderFrameHostImpl* frame = this; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 #if defined(USE_EXTERNAL_POPUP_MENU) | 655 #if defined(USE_EXTERNAL_POPUP_MENU) |
| 637 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) | 656 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) |
| 638 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) | 657 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) |
| 639 #endif | 658 #endif |
| 640 IPC_END_MESSAGE_MAP() | 659 IPC_END_MESSAGE_MAP() |
| 641 | 660 |
| 642 // No further actions here, since we may have been deleted. | 661 // No further actions here, since we may have been deleted. |
| 643 return handled; | 662 return handled; |
| 644 } | 663 } |
| 645 | 664 |
| 665 void RenderFrameHostImpl::OnAssociatedInterfaceRequest( |
| 666 const std::string& interface_name, |
| 667 mojo::ScopedInterfaceEndpointHandle handle) { |
| 668 associated_interface_registry_.BindRequest(interface_name, std::move(handle)); |
| 669 } |
| 670 |
| 646 void RenderFrameHostImpl::AccessibilitySetFocus(int object_id) { | 671 void RenderFrameHostImpl::AccessibilitySetFocus(int object_id) { |
| 647 Send(new AccessibilityMsg_SetFocus(routing_id_, object_id)); | 672 Send(new AccessibilityMsg_SetFocus(routing_id_, object_id)); |
| 648 } | 673 } |
| 649 | 674 |
| 650 void RenderFrameHostImpl::AccessibilityDoDefaultAction(int object_id) { | 675 void RenderFrameHostImpl::AccessibilityDoDefaultAction(int object_id) { |
| 651 Send(new AccessibilityMsg_DoDefaultAction(routing_id_, object_id)); | 676 Send(new AccessibilityMsg_DoDefaultAction(routing_id_, object_id)); |
| 652 } | 677 } |
| 653 | 678 |
| 654 void RenderFrameHostImpl::AccessibilityShowContextMenu(int acc_obj_id) { | 679 void RenderFrameHostImpl::AccessibilityShowContextMenu(int acc_obj_id) { |
| 655 Send(new AccessibilityMsg_ShowContextMenu(routing_id_, acc_obj_id)); | 680 Send(new AccessibilityMsg_ShowContextMenu(routing_id_, acc_obj_id)); |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 // reset. | 1481 // reset. |
| 1457 SetRenderFrameCreated(false); | 1482 SetRenderFrameCreated(false); |
| 1458 InvalidateMojoConnection(); | 1483 InvalidateMojoConnection(); |
| 1459 | 1484 |
| 1460 // Execute any pending AX tree snapshot callbacks with an empty response, | 1485 // Execute any pending AX tree snapshot callbacks with an empty response, |
| 1461 // since we're never going to get a response from this renderer. | 1486 // since we're never going to get a response from this renderer. |
| 1462 for (const auto& iter : ax_tree_snapshot_callbacks_) | 1487 for (const auto& iter : ax_tree_snapshot_callbacks_) |
| 1463 iter.second.Run(ui::AXTreeUpdate()); | 1488 iter.second.Run(ui::AXTreeUpdate()); |
| 1464 ax_tree_snapshot_callbacks_.clear(); | 1489 ax_tree_snapshot_callbacks_.clear(); |
| 1465 | 1490 |
| 1491 // Ensure that future remote interface requests are associated with the new |
| 1492 // process's channel. |
| 1493 remote_associated_interfaces_.reset(); |
| 1494 |
| 1466 if (!is_active()) { | 1495 if (!is_active()) { |
| 1467 // If the process has died, we don't need to wait for the swap out ack from | 1496 // 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 | 1497 // this RenderFrame if it is pending deletion. Complete the swap out to |
| 1469 // destroy it. | 1498 // destroy it. |
| 1470 OnSwappedOut(); | 1499 OnSwappedOut(); |
| 1471 } else { | 1500 } else { |
| 1472 // If this was the current pending or speculative RFH dying, cancel and | 1501 // If this was the current pending or speculative RFH dying, cancel and |
| 1473 // destroy it. | 1502 // destroy it. |
| 1474 frame_tree_node_->render_manager()->CancelPendingIfNecessary(this); | 1503 frame_tree_node_->render_manager()->CancelPendingIfNecessary(this); |
| 1475 } | 1504 } |
| (...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3055 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3084 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 3056 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3085 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 3057 return web_bluetooth_service_.get(); | 3086 return web_bluetooth_service_.get(); |
| 3058 } | 3087 } |
| 3059 | 3088 |
| 3060 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3089 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 3061 web_bluetooth_service_.reset(); | 3090 web_bluetooth_service_.reset(); |
| 3062 } | 3091 } |
| 3063 | 3092 |
| 3064 } // namespace content | 3093 } // namespace content |
| OLD | NEW |