| Index: chrome/renderer/autofill/autofill_agent.cc
|
| diff --git a/chrome/renderer/autofill/autofill_agent.cc b/chrome/renderer/autofill/autofill_agent.cc
|
| index 9130b105e71eaf0f2a001d4e6d92bdea6c459e2d..4d330932b8adb44ce8e345108a95533c1bdcf370 100644
|
| --- a/chrome/renderer/autofill/autofill_agent.cc
|
| +++ b/chrome/renderer/autofill/autofill_agent.cc
|
| @@ -76,6 +76,16 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
|
| OnFieldTypePredictionsAvailable)
|
| IPC_MESSAGE_HANDLER(AutofillMsg_SelectAutofillSuggestionAtIndex,
|
| OnSelectAutofillSuggestionAtIndex)
|
| + IPC_MESSAGE_HANDLER(AutofillMsg_SetAutofillActionFill,
|
| + OnSetAutofillActionFill)
|
| + IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm,
|
| + OnClearForm)
|
| + IPC_MESSAGE_HANDLER(AutofillMsg_SetAutofillActionPreview,
|
| + OnSetAutofillActionPreview)
|
| + IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm,
|
| + OnClearPreviewedForm)
|
| + IPC_MESSAGE_HANDLER(AutofillMsg_SetNodeText,
|
| + OnSetNodeText)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
| return handled;
|
| @@ -139,6 +149,8 @@ void AutofillAgent::didAcceptAutofillSuggestion(const WebNode& node,
|
| if (password_autofill_manager_->DidAcceptAutofillSuggestion(node, value))
|
| return;
|
|
|
| + DCHECK(node == autofill_query_element_);
|
| +
|
| if (suggestions_options_index_ != -1 &&
|
| index == static_cast<unsigned>(suggestions_options_index_)) {
|
| // User selected 'Autofill Options'.
|
| @@ -146,7 +158,6 @@ void AutofillAgent::didAcceptAutofillSuggestion(const WebNode& node,
|
| } else if (suggestions_clear_index_ != -1 &&
|
| index == static_cast<unsigned>(suggestions_clear_index_)) {
|
| // User selected 'Clear form'.
|
| - DCHECK(node == autofill_query_element_);
|
| form_cache_.ClearFormWithElement(autofill_query_element_);
|
| } else if (!unique_id) {
|
| // User selected an Autocomplete entry, so we fill directly.
|
| @@ -337,6 +348,8 @@ void AutofillAgent::OnFormDataFilled(int query_id,
|
| if (!render_view()->GetWebView() || query_id != autofill_query_id_)
|
| return;
|
|
|
| + was_query_node_autofilled_ = autofill_query_element_.isAutofilled();
|
| +
|
| switch (autofill_action_) {
|
| case AUTOFILL_FILL:
|
| FillForm(form, autofill_query_element_);
|
| @@ -344,6 +357,8 @@ void AutofillAgent::OnFormDataFilled(int query_id,
|
| base::TimeTicks::Now()));
|
| break;
|
| case AUTOFILL_PREVIEW:
|
| + didClearAutofillSelection(autofill_query_element_);
|
| +
|
| PreviewForm(form, autofill_query_element_);
|
| Send(new AutofillHostMsg_DidPreviewAutofillFormData(routing_id()));
|
| break;
|
| @@ -366,6 +381,29 @@ void AutofillAgent::OnSelectAutofillSuggestionAtIndex(int listIndex) {
|
| // render_view()->webview()->selectAutofillSuggestionAtIndex(listIndex);
|
| }
|
|
|
| +void AutofillAgent::OnSetAutofillActionFill() {
|
| + autofill_action_ = AUTOFILL_FILL;
|
| +}
|
| +
|
| +void AutofillAgent::OnClearForm() {
|
| + form_cache_.ClearFormWithElement(autofill_query_element_);
|
| +}
|
| +
|
| +void AutofillAgent::OnSetAutofillActionPreview() {
|
| + autofill_action_ = AUTOFILL_PREVIEW;
|
| +}
|
| +
|
| +void AutofillAgent::OnClearPreviewedForm() {
|
| + didClearAutofillSelection(autofill_query_element_);
|
| +}
|
| +
|
| +void AutofillAgent::OnSetNodeText(string16 value) {
|
| + string16 substring = value;
|
| + substring = substring.substr(0, autofill_query_element_.maxLength());
|
| +
|
| + autofill_query_element_.setValue(value, true);
|
| +}
|
| +
|
| void AutofillAgent::ShowSuggestions(const WebInputElement& element,
|
| bool autofill_on_empty_values,
|
| bool requires_caret_at_end,
|
| @@ -442,7 +480,6 @@ void AutofillAgent::FillAutofillFormData(const WebNode& node,
|
| }
|
|
|
| autofill_action_ = action;
|
| - was_query_node_autofilled_ = field.is_autofilled;
|
| Send(new AutofillHostMsg_FillAutofillFormData(
|
| routing_id(), autofill_query_id_, form, field, unique_id));
|
| }
|
|
|