| 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 "components/autofill/content/renderer/autofill_agent.h" | 5 #include "components/autofill/content/renderer/autofill_agent.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // The PageClickTracker is a RenderViewObserver, and hence will be freed when | 143 // The PageClickTracker is a RenderViewObserver, and hence will be freed when |
| 144 // the RenderView is destroyed. | 144 // the RenderView is destroyed. |
| 145 new PageClickTracker(render_view, this); | 145 new PageClickTracker(render_view, this); |
| 146 } | 146 } |
| 147 | 147 |
| 148 AutofillAgent::~AutofillAgent() {} | 148 AutofillAgent::~AutofillAgent() {} |
| 149 | 149 |
| 150 bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { | 150 bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { |
| 151 bool handled = true; | 151 bool handled = true; |
| 152 IPC_BEGIN_MESSAGE_MAP(AutofillAgent, message) | 152 IPC_BEGIN_MESSAGE_MAP(AutofillAgent, message) |
| 153 IPC_MESSAGE_HANDLER(AutofillMsg_Ping, OnPing) |
| 153 IPC_MESSAGE_HANDLER(AutofillMsg_FillForm, OnFillForm) | 154 IPC_MESSAGE_HANDLER(AutofillMsg_FillForm, OnFillForm) |
| 154 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewForm, OnPreviewForm) | 155 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewForm, OnPreviewForm) |
| 155 IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable, | 156 IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable, |
| 156 OnFieldTypePredictionsAvailable) | 157 OnFieldTypePredictionsAvailable) |
| 157 IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm, OnClearForm) | 158 IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm, OnClearForm) |
| 158 IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm) | 159 IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm) |
| 159 IPC_MESSAGE_HANDLER(AutofillMsg_FillFieldWithValue, OnFillFieldWithValue) | 160 IPC_MESSAGE_HANDLER(AutofillMsg_FillFieldWithValue, OnFillFieldWithValue) |
| 160 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewFieldWithValue, | 161 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewFieldWithValue, |
| 161 OnPreviewFieldWithValue) | 162 OnPreviewFieldWithValue) |
| 162 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion, | 163 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion, |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 void AutofillAgent::OnFillForm(int query_id, const FormData& form) { | 449 void AutofillAgent::OnFillForm(int query_id, const FormData& form) { |
| 449 if (!render_view()->GetWebView() || query_id != autofill_query_id_) | 450 if (!render_view()->GetWebView() || query_id != autofill_query_id_) |
| 450 return; | 451 return; |
| 451 | 452 |
| 452 was_query_node_autofilled_ = element_.isAutofilled(); | 453 was_query_node_autofilled_ = element_.isAutofilled(); |
| 453 FillForm(form, element_); | 454 FillForm(form, element_); |
| 454 Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id(), | 455 Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id(), |
| 455 base::TimeTicks::Now())); | 456 base::TimeTicks::Now())); |
| 456 } | 457 } |
| 457 | 458 |
| 459 void AutofillAgent::OnPing() { |
| 460 Send(new AutofillHostMsg_PingAck(routing_id())); |
| 461 } |
| 462 |
| 458 void AutofillAgent::OnPreviewForm(int query_id, const FormData& form) { | 463 void AutofillAgent::OnPreviewForm(int query_id, const FormData& form) { |
| 459 if (!render_view()->GetWebView() || query_id != autofill_query_id_) | 464 if (!render_view()->GetWebView() || query_id != autofill_query_id_) |
| 460 return; | 465 return; |
| 461 | 466 |
| 462 was_query_node_autofilled_ = element_.isAutofilled(); | 467 was_query_node_autofilled_ = element_.isAutofilled(); |
| 463 PreviewForm(form, element_); | 468 PreviewForm(form, element_); |
| 464 Send(new AutofillHostMsg_DidPreviewAutofillFormData(routing_id())); | 469 Send(new AutofillHostMsg_DidPreviewAutofillFormData(routing_id())); |
| 465 } | 470 } |
| 466 | 471 |
| 467 void AutofillAgent::OnClearForm() { | 472 void AutofillAgent::OnClearForm() { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 // parsed form. | 722 // parsed form. |
| 718 if (frame && !frame->parent() && !frame->isLoading()) { | 723 if (frame && !frame->parent() && !frame->isLoading()) { |
| 719 ProcessForms(*frame); | 724 ProcessForms(*frame); |
| 720 password_autofill_agent_->OnDynamicFormsSeen(frame); | 725 password_autofill_agent_->OnDynamicFormsSeen(frame); |
| 721 return; | 726 return; |
| 722 } | 727 } |
| 723 } | 728 } |
| 724 } | 729 } |
| 725 | 730 |
| 726 } // namespace autofill | 731 } // namespace autofill |
| OLD | NEW |