Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index 35b472ad167ac9eeff39a1eae3a9638b2fdd528b..90df314bc2cde18c690ebf2f499fd58f6666b2a4 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -74,6 +74,7 @@ |
| #include "content/public/common/context_menu_params.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/page_state.h" |
| #include "content/public/common/resource_response.h" |
| @@ -1571,6 +1572,8 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { |
| IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) |
| IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, |
| OnTextSurroundingSelectionRequest) |
| + IPC_MESSAGE_HANDLER(FrameMsg_FocusedFormFieldDataRequest, |
| + OnFocusedFormFieldDataRequest) |
| IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| OnSetAccessibilityMode) |
| IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, |
| @@ -2299,6 +2302,24 @@ void RenderFrameImpl::OnTextSurroundingSelectionRequest(uint32_t max_length) { |
| surroundingText.endOffsetInTextContent())); |
| } |
| +void RenderFrameImpl::OnFocusedFormFieldDataRequest(int request_id) { |
| + DCHECK(frame_); |
| + WebElement element = frame_->document().focusedElement(); |
|
EhsanK
2016/11/08 15:52:45
I noticed that the assumption here is |frame_| is
shaktisahu
2016/11/11 01:15:03
Ack! Added check for if |frame_| is still focused.
|
| + if (element.isNull()) |
| + return; |
| + |
| + DCHECK(GetRenderWidget()->GetWebWidget()); |
| + blink::WebTextInputInfo info = |
| + GetRenderWidget()->GetWebWidget()->textInputInfo(); |
| + FormFieldData field; |
| + field.text = info.value.utf8(); |
| + field.placeholder = element.getAttribute("placeholder").utf8(); |
| + field.text_input_type = GetRenderWidget()->GetTextInputType(); |
| + |
| + Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, |
| + field)); |
| +} |
| + |
| bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, |
| const base::string16& message, |
| const base::string16& default_value, |