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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 void AutofillAgent::OnFillForm(int query_id, const FormData& form) { | 448 void AutofillAgent::OnFillForm(int query_id, const FormData& form) { |
448 if (!render_view()->GetWebView() || query_id != autofill_query_id_) | 449 if (!render_view()->GetWebView() || query_id != autofill_query_id_) |
449 return; | 450 return; |
450 | 451 |
451 was_query_node_autofilled_ = element_.isAutofilled(); | 452 was_query_node_autofilled_ = element_.isAutofilled(); |
452 FillForm(form, element_); | 453 FillForm(form, element_); |
453 Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id(), | 454 Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id(), |
454 base::TimeTicks::Now())); | 455 base::TimeTicks::Now())); |
455 } | 456 } |
456 | 457 |
| 458 void AutofillAgent::OnPing() { |
| 459 Send(new AutofillHostMsg_PingAck(routing_id())); |
| 460 } |
| 461 |
457 void AutofillAgent::OnPreviewForm(int query_id, const FormData& form) { | 462 void AutofillAgent::OnPreviewForm(int query_id, const FormData& form) { |
458 if (!render_view()->GetWebView() || query_id != autofill_query_id_) | 463 if (!render_view()->GetWebView() || query_id != autofill_query_id_) |
459 return; | 464 return; |
460 | 465 |
461 was_query_node_autofilled_ = element_.isAutofilled(); | 466 was_query_node_autofilled_ = element_.isAutofilled(); |
462 PreviewForm(form, element_); | 467 PreviewForm(form, element_); |
463 Send(new AutofillHostMsg_DidPreviewAutofillFormData(routing_id())); | 468 Send(new AutofillHostMsg_DidPreviewAutofillFormData(routing_id())); |
464 } | 469 } |
465 | 470 |
466 void AutofillAgent::OnClearForm() { | 471 void AutofillAgent::OnClearForm() { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 // parsed form. | 721 // parsed form. |
717 if (frame && !frame->parent() && !frame->isLoading()) { | 722 if (frame && !frame->parent() && !frame->isLoading()) { |
718 ProcessForms(*frame); | 723 ProcessForms(*frame); |
719 password_autofill_agent_->OnDynamicFormsSeen(frame); | 724 password_autofill_agent_->OnDynamicFormsSeen(frame); |
720 return; | 725 return; |
721 } | 726 } |
722 } | 727 } |
723 } | 728 } |
724 | 729 |
725 } // namespace autofill | 730 } // namespace autofill |
OLD | NEW |