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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 void AutofillAgent::OnFillForm(int query_id, const FormData& form) { | 443 void AutofillAgent::OnFillForm(int query_id, const FormData& form) { |
443 if (!render_view()->GetWebView() || query_id != autofill_query_id_) | 444 if (!render_view()->GetWebView() || query_id != autofill_query_id_) |
444 return; | 445 return; |
445 | 446 |
446 was_query_node_autofilled_ = element_.isAutofilled(); | 447 was_query_node_autofilled_ = element_.isAutofilled(); |
447 FillForm(form, element_); | 448 FillForm(form, element_); |
448 Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id(), | 449 Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id(), |
449 base::TimeTicks::Now())); | 450 base::TimeTicks::Now())); |
450 } | 451 } |
451 | 452 |
| 453 void AutofillAgent::OnPing() { |
| 454 Send(new AutofillHostMsg_PingAck(routing_id())); |
| 455 } |
| 456 |
452 void AutofillAgent::OnPreviewForm(int query_id, const FormData& form) { | 457 void AutofillAgent::OnPreviewForm(int query_id, const FormData& form) { |
453 if (!render_view()->GetWebView() || query_id != autofill_query_id_) | 458 if (!render_view()->GetWebView() || query_id != autofill_query_id_) |
454 return; | 459 return; |
455 | 460 |
456 was_query_node_autofilled_ = element_.isAutofilled(); | 461 was_query_node_autofilled_ = element_.isAutofilled(); |
457 PreviewForm(form, element_); | 462 PreviewForm(form, element_); |
458 Send(new AutofillHostMsg_DidPreviewAutofillFormData(routing_id())); | 463 Send(new AutofillHostMsg_DidPreviewAutofillFormData(routing_id())); |
459 } | 464 } |
460 | 465 |
461 void AutofillAgent::OnClearForm() { | 466 void AutofillAgent::OnClearForm() { |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 // parsed form. | 707 // parsed form. |
703 if (frame && !frame->parent() && !frame->isLoading()) { | 708 if (frame && !frame->parent() && !frame->isLoading()) { |
704 ProcessForms(*frame); | 709 ProcessForms(*frame); |
705 password_autofill_agent_->OnDynamicFormsSeen(frame); | 710 password_autofill_agent_->OnDynamicFormsSeen(frame); |
706 return; | 711 return; |
707 } | 712 } |
708 } | 713 } |
709 } | 714 } |
710 | 715 |
711 } // namespace autofill | 716 } // namespace autofill |
OLD | NEW |