| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewForm, OnPreviewForm) | 154 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewForm, OnPreviewForm) |
| 155 IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable, | 155 IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable, |
| 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_FillPasswordSuggestion, |
| 165 OnAcceptPasswordAutofillSuggestion) | 165 OnFillPasswordSuggestion) |
| 166 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewPasswordSuggestion, |
| 167 OnPreviewPasswordSuggestion) |
| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 void AutofillAgent::OnPreviewFieldWithValue(const base::string16& value) { | 489 void AutofillAgent::OnPreviewFieldWithValue(const base::string16& value) { |
| 488 WebInputElement* input_element = toWebInputElement(&element_); | 490 WebInputElement* input_element = toWebInputElement(&element_); |
| 489 if (input_element) | 491 if (input_element) |
| 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::OnFillPasswordSuggestion(const base::string16& username, |
| 498 const base::string16& username, | 500 const base::string16& password) { |
| 499 const base::string16& password) { | 501 bool handled = password_autofill_agent_->FillSuggestion( |
| 500 bool handled = password_autofill_agent_->AcceptSuggestion( | |
| 501 element_, | 502 element_, |
| 502 username, | 503 username, |
| 503 password); | 504 password); |
| 505 DCHECK(handled); |
| 506 } |
| 507 |
| 508 void AutofillAgent::OnPreviewPasswordSuggestion( |
| 509 const base::string16& username, |
| 510 const base::string16& password) { |
| 511 bool handled = password_autofill_agent_->PreviewSuggestion( |
| 512 element_, |
| 513 username, |
| 514 password); |
| 504 DCHECK(handled); | 515 DCHECK(handled); |
| 505 } | 516 } |
| 506 | 517 |
| 507 void AutofillAgent::OnRequestAutocompleteResult( | 518 void AutofillAgent::OnRequestAutocompleteResult( |
| 508 WebFormElement::AutocompleteResult result, | 519 WebFormElement::AutocompleteResult result, |
| 509 const base::string16& message, | 520 const base::string16& message, |
| 510 const FormData& form_data) { | 521 const FormData& form_data) { |
| 511 if (in_flight_request_form_.isNull()) | 522 if (in_flight_request_form_.isNull()) |
| 512 return; | 523 return; |
| 513 | 524 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 // parsed form. | 713 // parsed form. |
| 703 if (frame && !frame->parent() && !frame->isLoading()) { | 714 if (frame && !frame->parent() && !frame->isLoading()) { |
| 704 ProcessForms(*frame); | 715 ProcessForms(*frame); |
| 705 password_autofill_agent_->OnDynamicFormsSeen(frame); | 716 password_autofill_agent_->OnDynamicFormsSeen(frame); |
| 706 return; | 717 return; |
| 707 } | 718 } |
| 708 } | 719 } |
| 709 } | 720 } |
| 710 | 721 |
| 711 } // namespace autofill | 722 } // namespace autofill |
| OLD | NEW |