| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 OnFieldTypePredictionsAvailable) | 156 OnFieldTypePredictionsAvailable) |
| 157 IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm, OnClearForm) | 157 IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm, OnClearForm) |
| 158 IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm) | 158 IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm) |
| 159 IPC_MESSAGE_HANDLER(AutofillMsg_FillFieldWithValue, OnFillFieldWithValue) | 159 IPC_MESSAGE_HANDLER(AutofillMsg_FillFieldWithValue, OnFillFieldWithValue) |
| 160 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewFieldWithValue, | 160 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewFieldWithValue, |
| 161 OnPreviewFieldWithValue) | 161 OnPreviewFieldWithValue) |
| 162 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion, | 162 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion, |
| 163 OnAcceptDataListSuggestion) | 163 OnAcceptDataListSuggestion) |
| 164 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptPasswordAutofillSuggestion, | 164 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptPasswordAutofillSuggestion, |
| 165 OnAcceptPasswordAutofillSuggestion) | 165 OnAcceptPasswordAutofillSuggestion) |
| 166 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewPasswordAutofillSuggestion, |
| 167 OnPreviewPasswordAutofillSuggestion) |
| 166 IPC_MESSAGE_HANDLER(AutofillMsg_RequestAutocompleteResult, | 168 IPC_MESSAGE_HANDLER(AutofillMsg_RequestAutocompleteResult, |
| 167 OnRequestAutocompleteResult) | 169 OnRequestAutocompleteResult) |
| 168 IPC_MESSAGE_UNHANDLED(handled = false) | 170 IPC_MESSAGE_UNHANDLED(handled = false) |
| 169 IPC_END_MESSAGE_MAP() | 171 IPC_END_MESSAGE_MAP() |
| 170 return handled; | 172 return handled; |
| 171 } | 173 } |
| 172 | 174 |
| 173 void AutofillAgent::DidFinishDocumentLoad(WebLocalFrame* frame) { | 175 void AutofillAgent::DidFinishDocumentLoad(WebLocalFrame* frame) { |
| 174 // If the main frame just finished loading, we should process it. | 176 // If the main frame just finished loading, we should process it. |
| 175 if (!frame->parent()) | 177 if (!frame->parent()) |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 PreviewFieldWithValue(value, input_element); | 492 PreviewFieldWithValue(value, input_element); |
| 491 } | 493 } |
| 492 | 494 |
| 493 void AutofillAgent::OnAcceptDataListSuggestion(const base::string16& value) { | 495 void AutofillAgent::OnAcceptDataListSuggestion(const base::string16& value) { |
| 494 AcceptDataListSuggestion(value); | 496 AcceptDataListSuggestion(value); |
| 495 } | 497 } |
| 496 | 498 |
| 497 void AutofillAgent::OnAcceptPasswordAutofillSuggestion( | 499 void AutofillAgent::OnAcceptPasswordAutofillSuggestion( |
| 498 const base::string16& username, | 500 const base::string16& username, |
| 499 const base::string16& password) { | 501 const base::string16& password) { |
| 500 bool handled = password_autofill_agent_->AcceptSuggestion( | 502 bool handled = password_autofill_agent_->FillSuggestion( |
| 501 element_, | 503 element_, |
| 502 username, | 504 username, |
| 503 password); | 505 password); |
| 506 DCHECK(handled); |
| 507 } |
| 508 |
| 509 void AutofillAgent::OnPreviewPasswordAutofillSuggestion( |
| 510 const base::string16& username, |
| 511 const base::string16& password) { |
| 512 bool handled = password_autofill_agent_->PreviewSuggestion( |
| 513 element_, |
| 514 username, |
| 515 password); |
| 504 DCHECK(handled); | 516 DCHECK(handled); |
| 505 } | 517 } |
| 506 | 518 |
| 507 void AutofillAgent::OnRequestAutocompleteResult( | 519 void AutofillAgent::OnRequestAutocompleteResult( |
| 508 WebFormElement::AutocompleteResult result, | 520 WebFormElement::AutocompleteResult result, |
| 509 const base::string16& message, | 521 const base::string16& message, |
| 510 const FormData& form_data) { | 522 const FormData& form_data) { |
| 511 if (in_flight_request_form_.isNull()) | 523 if (in_flight_request_form_.isNull()) |
| 512 return; | 524 return; |
| 513 | 525 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 // parsed form. | 714 // parsed form. |
| 703 if (frame && !frame->parent() && !frame->isLoading()) { | 715 if (frame && !frame->parent() && !frame->isLoading()) { |
| 704 ProcessForms(*frame); | 716 ProcessForms(*frame); |
| 705 password_autofill_agent_->OnDynamicFormsSeen(frame); | 717 password_autofill_agent_->OnDynamicFormsSeen(frame); |
| 706 return; | 718 return; |
| 707 } | 719 } |
| 708 } | 720 } |
| 709 } | 721 } |
| 710 | 722 |
| 711 } // namespace autofill | 723 } // namespace autofill |
| OLD | NEW |