Chromium Code Reviews| Index: content/browser/frame_host/render_frame_host_impl.cc |
| diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc |
| index 79cb7c2cb584f3cccf55095da3821c994025f68d..b1941818acc09798639eee3771dbef055afde3db 100644 |
| --- a/content/browser/frame_host/render_frame_host_impl.cc |
| +++ b/content/browser/frame_host/render_frame_host_impl.cc |
| @@ -86,6 +86,7 @@ |
| #include "content/public/common/content_switches.h" |
| #include "content/public/common/file_chooser_file_info.h" |
| #include "content/public/common/file_chooser_params.h" |
| +#include "content/public/common/form_field_data.h" |
| #include "content/public/common/isolated_world_ids.h" |
| #include "content/public/common/service_manager_connection.h" |
| #include "content/public/common/service_names.h" |
| @@ -388,6 +389,10 @@ RenderFrameHostImpl::~RenderFrameHostImpl() { |
| for (const auto& iter : visual_state_callbacks_) |
| iter.second.Run(false); |
| + // Run callbacks for the outstanding text input info requests, if any. |
| + for (const auto& iter : form_field_data_callbacks_) |
| + iter.second.Run(FormFieldData()); |
| + |
| if (render_widget_host_ && |
| render_widget_host_->owned_by_render_frame_host()) { |
| // Shutdown causes the RenderWidgetHost to delete itself. |
| @@ -693,6 +698,8 @@ bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { |
| IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) |
| IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
| OnTextSurroundingSelectionResponse) |
| + IPC_MESSAGE_HANDLER(FrameHostMsg_FocusedFormFieldDataResponse, |
| + OnFocusedFormFieldDataResponse) |
| IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
| IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
| OnAccessibilityLocationChanges) |
| @@ -1705,6 +1712,23 @@ void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( |
| text_surrounding_selection_callback_.Reset(); |
| } |
| +void RenderFrameHostImpl::RequestFocusedFormFieldData( |
| + FormFieldDataCallback& callback) { |
| + static int next_id = 1; |
| + int request_id = ++next_id; |
| + form_field_data_callbacks_[request_id] = callback; |
| + Send(new FrameMsg_FocusedFormFieldDataRequest(GetRoutingID(), request_id)); |
| +} |
| + |
| +void RenderFrameHostImpl::OnFocusedFormFieldDataResponse( |
| + int request_id, |
| + const FormFieldData& field_data) { |
| + DCHECK(form_field_data_callbacks_.find(request_id) != |
| + 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
|
| + form_field_data_callbacks_[request_id].Run(field_data); |
| + form_field_data_callbacks_.erase(request_id); |
| +} |
| + |
| void RenderFrameHostImpl::OnDidAccessInitialDocument() { |
| delegate_->DidAccessInitialDocument(); |
| } |