Chromium Code Reviews| Index: content/renderer/render_view_impl.cc |
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
| index 93479bcf1bd718cd0da2355b5ca3a92d82777561..37a1e92fc7d93129796105ec1feac02d2a3787a7 100644 |
| --- a/content/renderer/render_view_impl.cc |
| +++ b/content/renderer/render_view_impl.cc |
| @@ -63,6 +63,7 @@ |
| #include "content/public/common/content_switches.h" |
| #include "content/public/common/drop_data.h" |
| #include "content/public/common/favicon_url.h" |
| +#include "content/public/common/form_field_data.h" |
| #include "content/public/common/page_importance_signals.h" |
| #include "content/public/common/page_state.h" |
| #include "content/public/common/page_zoom.h" |
| @@ -1350,6 +1351,8 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
| OnReleaseDisambiguationPopupBitmap) |
| IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw) |
| IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) |
| + IPC_MESSAGE_HANDLER(ViewMsg_GetFocusedFormFieldData, |
| + OnFocusedFormFieldDataRequested) |
| // Page messages. |
| IPC_MESSAGE_HANDLER(PageMsg_UpdateWindowScreenRect, |
| @@ -1389,6 +1392,20 @@ void RenderViewImpl::OnSelectWordAroundCaret() { |
| input_handler_->set_handling_input_event(false); |
| } |
| +void RenderViewImpl::OnFocusedFormFieldDataRequested(int request_id) { |
| + blink::WebFrame* web_frame = webview()->focusedFrame(); |
|
David Trainor- moved to gerrit
2016/11/03 04:25:49
Should we check if webview() is null or webview()-
|
| + WebElement element = web_frame->document().focusedElement(); |
|
David Trainor- moved to gerrit
2016/11/03 04:25:49
Check if document().isNull()? Check if focusedEle
|
| + |
| + blink::WebTextInputInfo info = GetWebWidget()->textInputInfo(); |
|
David Trainor- moved to gerrit
2016/11/03 04:25:50
Check if GetWebWidget() is null?
|
| + FormFieldData field; |
| + field.text = info.value.utf8(); |
|
David Trainor- moved to gerrit
2016/11/03 04:25:50
Are all of these guaranteed to be valid? info.val
|
| + field.placeholder = element.getAttribute("placeholder").utf8(); |
| + field.text_input_type = GetTextInputType(); |
| + |
| + Send( |
| + new ViewHostMsg_SetFocusedFormFieldData(routing_id(), request_id, field)); |
| +} |
| + |
| void RenderViewImpl::OnUpdateTargetURLAck() { |
| // Check if there is a targeturl waiting to be sent. |
| if (target_url_status_ == TARGET_PENDING) |