| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #include "content/public/browser/resource_context.h" | 79 #include "content/public/browser/resource_context.h" |
| 80 #include "content/public/browser/storage_partition.h" | 80 #include "content/public/browser/storage_partition.h" |
| 81 #include "content/public/browser/stream_handle.h" | 81 #include "content/public/browser/stream_handle.h" |
| 82 #include "content/public/browser/user_metrics.h" | 82 #include "content/public/browser/user_metrics.h" |
| 83 #include "content/public/common/browser_side_navigation_policy.h" | 83 #include "content/public/common/browser_side_navigation_policy.h" |
| 84 #include "content/public/common/content_constants.h" | 84 #include "content/public/common/content_constants.h" |
| 85 #include "content/public/common/content_features.h" | 85 #include "content/public/common/content_features.h" |
| 86 #include "content/public/common/content_switches.h" | 86 #include "content/public/common/content_switches.h" |
| 87 #include "content/public/common/file_chooser_file_info.h" | 87 #include "content/public/common/file_chooser_file_info.h" |
| 88 #include "content/public/common/file_chooser_params.h" | 88 #include "content/public/common/file_chooser_params.h" |
| 89 #include "content/public/common/form_field_data.h" |
| 89 #include "content/public/common/isolated_world_ids.h" | 90 #include "content/public/common/isolated_world_ids.h" |
| 90 #include "content/public/common/service_manager_connection.h" | 91 #include "content/public/common/service_manager_connection.h" |
| 91 #include "content/public/common/url_constants.h" | 92 #include "content/public/common/url_constants.h" |
| 92 #include "content/public/common/url_utils.h" | 93 #include "content/public/common/url_utils.h" |
| 93 #include "device/generic_sensor/sensor_provider_impl.h" | 94 #include "device/generic_sensor/sensor_provider_impl.h" |
| 94 #include "device/geolocation/geolocation_service_context.h" | 95 #include "device/geolocation/geolocation_service_context.h" |
| 95 #include "device/vibration/vibration_manager_impl.h" | 96 #include "device/vibration/vibration_manager_impl.h" |
| 96 #include "device/wake_lock/wake_lock_service_context.h" | 97 #include "device/wake_lock/wake_lock_service_context.h" |
| 97 #include "media/base/media_switches.h" | 98 #include "media/base/media_switches.h" |
| 98 #include "media/mojo/interfaces/media_service.mojom.h" | 99 #include "media/mojo/interfaces/media_service.mojom.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 Send(new FrameMsg_Delete(routing_id_)); | 379 Send(new FrameMsg_Delete(routing_id_)); |
| 379 } | 380 } |
| 380 | 381 |
| 381 // Null out the swapout timer; in crash dumps this member will be null only if | 382 // Null out the swapout timer; in crash dumps this member will be null only if |
| 382 // the dtor has run. (It may also be null in tests.) | 383 // the dtor has run. (It may also be null in tests.) |
| 383 swapout_event_monitor_timeout_.reset(); | 384 swapout_event_monitor_timeout_.reset(); |
| 384 | 385 |
| 385 for (const auto& iter : visual_state_callbacks_) | 386 for (const auto& iter : visual_state_callbacks_) |
| 386 iter.second.Run(false); | 387 iter.second.Run(false); |
| 387 | 388 |
| 389 // Run callbacks for the outstanding text input info requests, if any. |
| 390 for (const auto& iter : form_field_data_callbacks_) |
| 391 iter.second.Run(FormFieldData()); |
| 392 |
| 388 if (render_widget_host_ && | 393 if (render_widget_host_ && |
| 389 render_widget_host_->owned_by_render_frame_host()) { | 394 render_widget_host_->owned_by_render_frame_host()) { |
| 390 // Shutdown causes the RenderWidgetHost to delete itself. | 395 // Shutdown causes the RenderWidgetHost to delete itself. |
| 391 render_widget_host_->ShutdownAndDestroyWidget(true); | 396 render_widget_host_->ShutdownAndDestroyWidget(true); |
| 392 } | 397 } |
| 393 | 398 |
| 394 // Notify the FrameTree that this RFH is going away, allowing it to shut down | 399 // Notify the FrameTree that this RFH is going away, allowing it to shut down |
| 395 // the corresponding RenderViewHost if it is no longer needed. | 400 // the corresponding RenderViewHost if it is no longer needed. |
| 396 frame_tree_->ReleaseRenderViewHostRef(render_view_host_); | 401 frame_tree_->ReleaseRenderViewHostRef(render_view_host_); |
| 397 } | 402 } |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 OnDidChangeSandboxFlags) | 688 OnDidChangeSandboxFlags) |
| 684 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeFrameOwnerProperties, | 689 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeFrameOwnerProperties, |
| 685 OnDidChangeFrameOwnerProperties) | 690 OnDidChangeFrameOwnerProperties) |
| 686 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 691 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
| 687 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 692 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
| 688 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 693 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
| 689 OnBeginNavigation) | 694 OnBeginNavigation) |
| 690 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) | 695 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) |
| 691 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 696 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
| 692 OnTextSurroundingSelectionResponse) | 697 OnTextSurroundingSelectionResponse) |
| 698 IPC_MESSAGE_HANDLER(FrameHostMsg_FocusedFormFieldDataResponse, |
| 699 OnFocusedFormFieldDataResponse) |
| 693 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 700 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
| 694 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 701 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
| 695 OnAccessibilityLocationChanges) | 702 OnAccessibilityLocationChanges) |
| 696 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, | 703 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, |
| 697 OnAccessibilityFindInPageResult) | 704 OnAccessibilityFindInPageResult) |
| 698 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_ChildFrameHitTestResult, | 705 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_ChildFrameHitTestResult, |
| 699 OnAccessibilityChildFrameHitTestResult) | 706 OnAccessibilityChildFrameHitTestResult) |
| 700 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, | 707 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, |
| 701 OnAccessibilitySnapshotResponse) | 708 OnAccessibilitySnapshotResponse) |
| 702 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) | 709 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( | 1661 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( |
| 1655 const base::string16& content, | 1662 const base::string16& content, |
| 1656 uint32_t start_offset, | 1663 uint32_t start_offset, |
| 1657 uint32_t end_offset) { | 1664 uint32_t end_offset) { |
| 1658 // Just Run the callback instead of propagating further. | 1665 // Just Run the callback instead of propagating further. |
| 1659 text_surrounding_selection_callback_.Run(content, start_offset, end_offset); | 1666 text_surrounding_selection_callback_.Run(content, start_offset, end_offset); |
| 1660 // Reset the callback for enabling early exit from future request. | 1667 // Reset the callback for enabling early exit from future request. |
| 1661 text_surrounding_selection_callback_.Reset(); | 1668 text_surrounding_selection_callback_.Reset(); |
| 1662 } | 1669 } |
| 1663 | 1670 |
| 1671 void RenderFrameHostImpl::RequestFocusedFormFieldData( |
| 1672 FormFieldDataCallback& callback) { |
| 1673 static int next_id = 1; |
| 1674 int request_id = ++next_id; |
| 1675 form_field_data_callbacks_[request_id] = callback; |
| 1676 Send(new FrameMsg_FocusedFormFieldDataRequest(GetRoutingID(), request_id)); |
| 1677 } |
| 1678 |
| 1679 void RenderFrameHostImpl::OnFocusedFormFieldDataResponse( |
| 1680 int request_id, |
| 1681 const FormFieldData& field_data) { |
| 1682 DCHECK(form_field_data_callbacks_.find(request_id) != |
| 1683 form_field_data_callbacks_.end()); |
| 1684 form_field_data_callbacks_[request_id].Run(field_data); |
| 1685 form_field_data_callbacks_.erase(request_id); |
| 1686 } |
| 1687 |
| 1664 void RenderFrameHostImpl::OnDidAccessInitialDocument() { | 1688 void RenderFrameHostImpl::OnDidAccessInitialDocument() { |
| 1665 delegate_->DidAccessInitialDocument(); | 1689 delegate_->DidAccessInitialDocument(); |
| 1666 } | 1690 } |
| 1667 | 1691 |
| 1668 void RenderFrameHostImpl::OnDidChangeOpener(int32_t opener_routing_id) { | 1692 void RenderFrameHostImpl::OnDidChangeOpener(int32_t opener_routing_id) { |
| 1669 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, | 1693 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, |
| 1670 GetSiteInstance()); | 1694 GetSiteInstance()); |
| 1671 } | 1695 } |
| 1672 | 1696 |
| 1673 void RenderFrameHostImpl::OnDidChangeName(const std::string& name, | 1697 void RenderFrameHostImpl::OnDidChangeName(const std::string& name, |
| (...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3139 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3163 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 3140 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3164 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 3141 return web_bluetooth_service_.get(); | 3165 return web_bluetooth_service_.get(); |
| 3142 } | 3166 } |
| 3143 | 3167 |
| 3144 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3168 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 3145 web_bluetooth_service_.reset(); | 3169 web_bluetooth_service_.reset(); |
| 3146 } | 3170 } |
| 3147 | 3171 |
| 3148 } // namespace content | 3172 } // namespace content |
| OLD | NEW |