| 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/service_names.h" | 92 #include "content/public/common/service_names.h" |
| 92 #include "content/public/common/url_constants.h" | 93 #include "content/public/common/url_constants.h" |
| 93 #include "content/public/common/url_utils.h" | 94 #include "content/public/common/url_utils.h" |
| 94 #include "device/generic_sensor/sensor_provider_impl.h" | 95 #include "device/generic_sensor/sensor_provider_impl.h" |
| 95 #include "device/geolocation/geolocation_service_context.h" | 96 #include "device/geolocation/geolocation_service_context.h" |
| 96 #include "device/vibration/vibration_manager_impl.h" | 97 #include "device/vibration/vibration_manager_impl.h" |
| 97 #include "device/wake_lock/wake_lock_service_context.h" | 98 #include "device/wake_lock/wake_lock_service_context.h" |
| 98 #include "media/base/media_switches.h" | 99 #include "media/base/media_switches.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 Send(new FrameMsg_Delete(routing_id_)); | 382 Send(new FrameMsg_Delete(routing_id_)); |
| 382 } | 383 } |
| 383 | 384 |
| 384 // Null out the swapout timer; in crash dumps this member will be null only if | 385 // Null out the swapout timer; in crash dumps this member will be null only if |
| 385 // the dtor has run. (It may also be null in tests.) | 386 // the dtor has run. (It may also be null in tests.) |
| 386 swapout_event_monitor_timeout_.reset(); | 387 swapout_event_monitor_timeout_.reset(); |
| 387 | 388 |
| 388 for (const auto& iter : visual_state_callbacks_) | 389 for (const auto& iter : visual_state_callbacks_) |
| 389 iter.second.Run(false); | 390 iter.second.Run(false); |
| 390 | 391 |
| 392 form_field_data_callbacks_.clear(); |
| 393 |
| 391 if (render_widget_host_ && | 394 if (render_widget_host_ && |
| 392 render_widget_host_->owned_by_render_frame_host()) { | 395 render_widget_host_->owned_by_render_frame_host()) { |
| 393 // Shutdown causes the RenderWidgetHost to delete itself. | 396 // Shutdown causes the RenderWidgetHost to delete itself. |
| 394 render_widget_host_->ShutdownAndDestroyWidget(true); | 397 render_widget_host_->ShutdownAndDestroyWidget(true); |
| 395 } | 398 } |
| 396 | 399 |
| 397 // Notify the FrameTree that this RFH is going away, allowing it to shut down | 400 // Notify the FrameTree that this RFH is going away, allowing it to shut down |
| 398 // the corresponding RenderViewHost if it is no longer needed. | 401 // the corresponding RenderViewHost if it is no longer needed. |
| 399 frame_tree_->ReleaseRenderViewHostRef(render_view_host_); | 402 frame_tree_->ReleaseRenderViewHostRef(render_view_host_); |
| 400 } | 403 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 OnDidChangeSandboxFlags) | 690 OnDidChangeSandboxFlags) |
| 688 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeFrameOwnerProperties, | 691 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeFrameOwnerProperties, |
| 689 OnDidChangeFrameOwnerProperties) | 692 OnDidChangeFrameOwnerProperties) |
| 690 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 693 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
| 691 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 694 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
| 692 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 695 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
| 693 OnBeginNavigation) | 696 OnBeginNavigation) |
| 694 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) | 697 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) |
| 695 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 698 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
| 696 OnTextSurroundingSelectionResponse) | 699 OnTextSurroundingSelectionResponse) |
| 700 IPC_MESSAGE_HANDLER(FrameHostMsg_FocusedFormFieldDataResponse, |
| 701 OnFocusedFormFieldDataResponse) |
| 697 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 702 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
| 698 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 703 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
| 699 OnAccessibilityLocationChanges) | 704 OnAccessibilityLocationChanges) |
| 700 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, | 705 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, |
| 701 OnAccessibilityFindInPageResult) | 706 OnAccessibilityFindInPageResult) |
| 702 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_ChildFrameHitTestResult, | 707 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_ChildFrameHitTestResult, |
| 703 OnAccessibilityChildFrameHitTestResult) | 708 OnAccessibilityChildFrameHitTestResult) |
| 704 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, | 709 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, |
| 705 OnAccessibilitySnapshotResponse) | 710 OnAccessibilitySnapshotResponse) |
| 706 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) | 711 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 | 1473 |
| 1469 // Reset state for the current RenderFrameHost once the FrameTreeNode has been | 1474 // Reset state for the current RenderFrameHost once the FrameTreeNode has been |
| 1470 // reset. | 1475 // reset. |
| 1471 SetRenderFrameCreated(false); | 1476 SetRenderFrameCreated(false); |
| 1472 InvalidateMojoConnection(); | 1477 InvalidateMojoConnection(); |
| 1473 | 1478 |
| 1474 // Execute any pending AX tree snapshot callbacks with an empty response, | 1479 // Execute any pending AX tree snapshot callbacks with an empty response, |
| 1475 // since we're never going to get a response from this renderer. | 1480 // since we're never going to get a response from this renderer. |
| 1476 for (const auto& iter : ax_tree_snapshot_callbacks_) | 1481 for (const auto& iter : ax_tree_snapshot_callbacks_) |
| 1477 iter.second.Run(ui::AXTreeUpdate()); | 1482 iter.second.Run(ui::AXTreeUpdate()); |
| 1483 |
| 1478 ax_tree_snapshot_callbacks_.clear(); | 1484 ax_tree_snapshot_callbacks_.clear(); |
| 1485 javascript_callbacks_.clear(); |
| 1486 visual_state_callbacks_.clear(); |
| 1487 form_field_data_callbacks_.clear(); |
| 1479 | 1488 |
| 1480 // Ensure that future remote interface requests are associated with the new | 1489 // Ensure that future remote interface requests are associated with the new |
| 1481 // process's channel. | 1490 // process's channel. |
| 1482 remote_associated_interfaces_.reset(); | 1491 remote_associated_interfaces_.reset(); |
| 1483 | 1492 |
| 1484 if (!is_active()) { | 1493 if (!is_active()) { |
| 1485 // If the process has died, we don't need to wait for the swap out ack from | 1494 // If the process has died, we don't need to wait for the swap out ack from |
| 1486 // this RenderFrame if it is pending deletion. Complete the swap out to | 1495 // this RenderFrame if it is pending deletion. Complete the swap out to |
| 1487 // destroy it. | 1496 // destroy it. |
| 1488 OnSwappedOut(); | 1497 OnSwappedOut(); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( | 1665 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( |
| 1657 const base::string16& content, | 1666 const base::string16& content, |
| 1658 uint32_t start_offset, | 1667 uint32_t start_offset, |
| 1659 uint32_t end_offset) { | 1668 uint32_t end_offset) { |
| 1660 // Just Run the callback instead of propagating further. | 1669 // Just Run the callback instead of propagating further. |
| 1661 text_surrounding_selection_callback_.Run(content, start_offset, end_offset); | 1670 text_surrounding_selection_callback_.Run(content, start_offset, end_offset); |
| 1662 // Reset the callback for enabling early exit from future request. | 1671 // Reset the callback for enabling early exit from future request. |
| 1663 text_surrounding_selection_callback_.Reset(); | 1672 text_surrounding_selection_callback_.Reset(); |
| 1664 } | 1673 } |
| 1665 | 1674 |
| 1675 void RenderFrameHostImpl::RequestFocusedFormFieldData( |
| 1676 FormFieldDataCallback& callback) { |
| 1677 static int next_id = 1; |
| 1678 int request_id = ++next_id; |
| 1679 form_field_data_callbacks_[request_id] = callback; |
| 1680 Send(new FrameMsg_FocusedFormFieldDataRequest(GetRoutingID(), request_id)); |
| 1681 } |
| 1682 |
| 1683 void RenderFrameHostImpl::OnFocusedFormFieldDataResponse( |
| 1684 int request_id, |
| 1685 const FormFieldData& field_data) { |
| 1686 auto it = form_field_data_callbacks_.find(request_id); |
| 1687 if (it != form_field_data_callbacks_.end()) { |
| 1688 it->second.Run(field_data); |
| 1689 form_field_data_callbacks_.erase(it); |
| 1690 } |
| 1691 } |
| 1692 |
| 1666 void RenderFrameHostImpl::OnDidAccessInitialDocument() { | 1693 void RenderFrameHostImpl::OnDidAccessInitialDocument() { |
| 1667 delegate_->DidAccessInitialDocument(); | 1694 delegate_->DidAccessInitialDocument(); |
| 1668 } | 1695 } |
| 1669 | 1696 |
| 1670 void RenderFrameHostImpl::OnDidChangeOpener(int32_t opener_routing_id) { | 1697 void RenderFrameHostImpl::OnDidChangeOpener(int32_t opener_routing_id) { |
| 1671 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, | 1698 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, |
| 1672 GetSiteInstance()); | 1699 GetSiteInstance()); |
| 1673 } | 1700 } |
| 1674 | 1701 |
| 1675 void RenderFrameHostImpl::OnDidChangeName(const std::string& name, | 1702 void RenderFrameHostImpl::OnDidChangeName(const std::string& name, |
| (...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3246 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3273 // There is no pending NavigationEntry in these cases, so pass 0 as the |
| 3247 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3274 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
| 3248 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3275 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
| 3249 return NavigationHandleImpl::Create( | 3276 return NavigationHandleImpl::Create( |
| 3250 params.url, frame_tree_node_, is_renderer_initiated, | 3277 params.url, frame_tree_node_, is_renderer_initiated, |
| 3251 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), | 3278 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), |
| 3252 entry_id_for_data_nav, false); // started_from_context_menu | 3279 entry_id_for_data_nav, false); // started_from_context_menu |
| 3253 } | 3280 } |
| 3254 | 3281 |
| 3255 } // namespace content | 3282 } // namespace content |
| OLD | NEW |