Chromium Code Reviews| 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 // Run callbacks for the outstanding text input info requests, if any. | |
| 393 for (const auto& iter : form_field_data_callbacks_) | |
| 394 iter.second.Run(FormFieldData()); | |
| 395 | |
| 391 if (render_widget_host_ && | 396 if (render_widget_host_ && |
| 392 render_widget_host_->owned_by_render_frame_host()) { | 397 render_widget_host_->owned_by_render_frame_host()) { |
| 393 // Shutdown causes the RenderWidgetHost to delete itself. | 398 // Shutdown causes the RenderWidgetHost to delete itself. |
| 394 render_widget_host_->ShutdownAndDestroyWidget(true); | 399 render_widget_host_->ShutdownAndDestroyWidget(true); |
| 395 } | 400 } |
| 396 | 401 |
| 397 // Notify the FrameTree that this RFH is going away, allowing it to shut down | 402 // Notify the FrameTree that this RFH is going away, allowing it to shut down |
| 398 // the corresponding RenderViewHost if it is no longer needed. | 403 // the corresponding RenderViewHost if it is no longer needed. |
| 399 frame_tree_->ReleaseRenderViewHostRef(render_view_host_); | 404 frame_tree_->ReleaseRenderViewHostRef(render_view_host_); |
| 400 } | 405 } |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 686 OnDidChangeSandboxFlags) | 691 OnDidChangeSandboxFlags) |
| 687 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeFrameOwnerProperties, | 692 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeFrameOwnerProperties, |
| 688 OnDidChangeFrameOwnerProperties) | 693 OnDidChangeFrameOwnerProperties) |
| 689 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 694 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
| 690 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 695 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
| 691 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 696 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
| 692 OnBeginNavigation) | 697 OnBeginNavigation) |
| 693 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) | 698 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) |
| 694 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 699 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
| 695 OnTextSurroundingSelectionResponse) | 700 OnTextSurroundingSelectionResponse) |
| 701 IPC_MESSAGE_HANDLER(FrameHostMsg_FocusedFormFieldDataResponse, | |
| 702 OnFocusedFormFieldDataResponse) | |
| 696 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 703 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
| 697 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 704 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
| 698 OnAccessibilityLocationChanges) | 705 OnAccessibilityLocationChanges) |
| 699 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, | 706 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, |
| 700 OnAccessibilityFindInPageResult) | 707 OnAccessibilityFindInPageResult) |
| 701 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_ChildFrameHitTestResult, | 708 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_ChildFrameHitTestResult, |
| 702 OnAccessibilityChildFrameHitTestResult) | 709 OnAccessibilityChildFrameHitTestResult) |
| 703 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, | 710 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, |
| 704 OnAccessibilitySnapshotResponse) | 711 OnAccessibilitySnapshotResponse) |
| 705 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) | 712 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1698 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( | 1705 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( |
| 1699 const base::string16& content, | 1706 const base::string16& content, |
| 1700 uint32_t start_offset, | 1707 uint32_t start_offset, |
| 1701 uint32_t end_offset) { | 1708 uint32_t end_offset) { |
| 1702 // Just Run the callback instead of propagating further. | 1709 // Just Run the callback instead of propagating further. |
| 1703 text_surrounding_selection_callback_.Run(content, start_offset, end_offset); | 1710 text_surrounding_selection_callback_.Run(content, start_offset, end_offset); |
| 1704 // Reset the callback for enabling early exit from future request. | 1711 // Reset the callback for enabling early exit from future request. |
| 1705 text_surrounding_selection_callback_.Reset(); | 1712 text_surrounding_selection_callback_.Reset(); |
| 1706 } | 1713 } |
| 1707 | 1714 |
| 1715 void RenderFrameHostImpl::RequestFocusedFormFieldData( | |
| 1716 FormFieldDataCallback& callback) { | |
| 1717 static int next_id = 1; | |
| 1718 int request_id = ++next_id; | |
| 1719 form_field_data_callbacks_[request_id] = callback; | |
| 1720 Send(new FrameMsg_FocusedFormFieldDataRequest(GetRoutingID(), request_id)); | |
| 1721 } | |
| 1722 | |
| 1723 void RenderFrameHostImpl::OnFocusedFormFieldDataResponse( | |
| 1724 int request_id, | |
| 1725 const FormFieldData& field_data) { | |
| 1726 DCHECK(form_field_data_callbacks_.find(request_id) != | |
| 1727 form_field_data_callbacks_.end()); | |
|
Charlie Reis
2016/11/11 22:20:46
This should not be a DCHECK if it's in response to
shaktisahu
2016/11/15 05:44:54
Done. Sure, this should be an early return with NO
| |
| 1728 form_field_data_callbacks_[request_id].Run(field_data); | |
| 1729 form_field_data_callbacks_.erase(request_id); | |
| 1730 } | |
| 1731 | |
| 1708 void RenderFrameHostImpl::OnDidAccessInitialDocument() { | 1732 void RenderFrameHostImpl::OnDidAccessInitialDocument() { |
| 1709 delegate_->DidAccessInitialDocument(); | 1733 delegate_->DidAccessInitialDocument(); |
| 1710 } | 1734 } |
| 1711 | 1735 |
| 1712 void RenderFrameHostImpl::OnDidChangeOpener(int32_t opener_routing_id) { | 1736 void RenderFrameHostImpl::OnDidChangeOpener(int32_t opener_routing_id) { |
| 1713 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, | 1737 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, |
| 1714 GetSiteInstance()); | 1738 GetSiteInstance()); |
| 1715 } | 1739 } |
| 1716 | 1740 |
| 1717 void RenderFrameHostImpl::OnDidChangeName(const std::string& name, | 1741 void RenderFrameHostImpl::OnDidChangeName(const std::string& name, |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3204 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3228 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 3205 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3229 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 3206 return web_bluetooth_service_.get(); | 3230 return web_bluetooth_service_.get(); |
| 3207 } | 3231 } |
| 3208 | 3232 |
| 3209 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3233 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 3210 web_bluetooth_service_.reset(); | 3234 web_bluetooth_service_.reset(); |
| 3211 } | 3235 } |
| 3212 | 3236 |
| 3213 } // namespace content | 3237 } // namespace content |
| OLD | NEW |