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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <tuple> | 9 #include <tuple> |
10 | 10 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 bool AutofillAgent::FormDataCompare::operator()(const FormData& lhs, | 199 bool AutofillAgent::FormDataCompare::operator()(const FormData& lhs, |
200 const FormData& rhs) const { | 200 const FormData& rhs) const { |
201 return std::tie(lhs.name, lhs.origin, lhs.action, lhs.is_form_tag) < | 201 return std::tie(lhs.name, lhs.origin, lhs.action, lhs.is_form_tag) < |
202 std::tie(rhs.name, rhs.origin, rhs.action, rhs.is_form_tag); | 202 std::tie(rhs.name, rhs.origin, rhs.action, rhs.is_form_tag); |
203 } | 203 } |
204 | 204 |
205 bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { | 205 bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { |
206 bool handled = true; | 206 bool handled = true; |
207 IPC_BEGIN_MESSAGE_MAP(AutofillAgent, message) | 207 IPC_BEGIN_MESSAGE_MAP(AutofillAgent, message) |
208 IPC_MESSAGE_HANDLER(AutofillMsg_FillForm, OnFillForm) | |
209 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewForm, OnPreviewForm) | 208 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewForm, OnPreviewForm) |
210 IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable, | 209 IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable, |
211 OnFieldTypePredictionsAvailable) | 210 OnFieldTypePredictionsAvailable) |
212 IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm, OnClearForm) | 211 IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm, OnClearForm) |
213 IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm) | 212 IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm) |
214 IPC_MESSAGE_HANDLER(AutofillMsg_FillFieldWithValue, OnFillFieldWithValue) | 213 IPC_MESSAGE_HANDLER(AutofillMsg_FillFieldWithValue, OnFillFieldWithValue) |
215 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewFieldWithValue, | 214 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewFieldWithValue, |
216 OnPreviewFieldWithValue) | 215 OnPreviewFieldWithValue) |
217 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion, | 216 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion, |
218 OnAcceptDataListSuggestion) | 217 OnAcceptDataListSuggestion) |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 FillFieldWithValue(new_value, input_element); | 499 FillFieldWithValue(new_value, input_element); |
501 } | 500 } |
502 | 501 |
503 void AutofillAgent::OnFieldTypePredictionsAvailable( | 502 void AutofillAgent::OnFieldTypePredictionsAvailable( |
504 const std::vector<FormDataPredictions>& forms) { | 503 const std::vector<FormDataPredictions>& forms) { |
505 for (size_t i = 0; i < forms.size(); ++i) { | 504 for (size_t i = 0; i < forms.size(); ++i) { |
506 form_cache_.ShowPredictions(forms[i]); | 505 form_cache_.ShowPredictions(forms[i]); |
507 } | 506 } |
508 } | 507 } |
509 | 508 |
510 void AutofillAgent::OnFillForm(int query_id, const FormData& form) { | 509 // mojom::AutofillAgent: |
511 if (query_id != autofill_query_id_) | 510 void AutofillAgent::FirstUserGestureObservedInTab() { |
| 511 password_autofill_agent_->FirstUserGestureObserved(); |
| 512 } |
| 513 |
| 514 void AutofillAgent::FillForm(int32_t id, |
| 515 const FormData& form, |
| 516 const FillFormCallback& callback) { |
| 517 if (id != autofill_query_id_) |
512 return; | 518 return; |
513 | 519 |
514 was_query_node_autofilled_ = element_.isAutofilled(); | 520 was_query_node_autofilled_ = element_.isAutofilled(); |
515 form_util::FillForm(form, element_); | 521 form_util::FillForm(form, element_); |
516 if (!element_.form().isNull()) | 522 if (!element_.form().isNull()) |
517 last_interacted_form_ = element_.form(); | 523 last_interacted_form_ = element_.form(); |
518 | 524 |
519 Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id(), form, | 525 callback.Run(form, base::TimeTicks::Now().ToInternalValue()); |
520 base::TimeTicks::Now())); | |
521 } | |
522 | |
523 // mojom::AutofillAgent: | |
524 void AutofillAgent::FirstUserGestureObservedInTab() { | |
525 password_autofill_agent_->FirstUserGestureObserved(); | |
526 } | 526 } |
527 | 527 |
528 void AutofillAgent::OnPing() { | 528 void AutofillAgent::OnPing() { |
529 Send(new AutofillHostMsg_PingAck(routing_id())); | 529 Send(new AutofillHostMsg_PingAck(routing_id())); |
530 } | 530 } |
531 | 531 |
532 void AutofillAgent::OnPreviewForm(int query_id, const FormData& form) { | 532 void AutofillAgent::OnPreviewForm(int query_id, const FormData& form) { |
533 if (query_id != autofill_query_id_) | 533 if (query_id != autofill_query_id_) |
534 return; | 534 return; |
535 | 535 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { | 799 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { |
800 // No-op. Don't delete |this|. | 800 // No-op. Don't delete |this|. |
801 } | 801 } |
802 | 802 |
803 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { | 803 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { |
804 if (agent_) | 804 if (agent_) |
805 agent_->FocusChangeComplete(); | 805 agent_->FocusChangeComplete(); |
806 } | 806 } |
807 | 807 |
808 } // namespace autofill | 808 } // namespace autofill |
OLD | NEW |