Chromium Code Reviews| 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" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "components/autofill/content/renderer/form_autofill_util.h" | 14 #include "components/autofill/content/renderer/form_autofill_util.h" |
| 15 #include "components/autofill/content/renderer/page_click_tracker.h" | 15 #include "components/autofill/content/renderer/page_click_tracker.h" |
| 16 #include "components/autofill/content/renderer/password_autofill_agent.h" | 16 #include "components/autofill/content/renderer/password_autofill_agent.h" |
| 17 #include "components/autofill/content/renderer/password_form_conversion_utils.h" | |
| 17 #include "components/autofill/core/common/autofill_constants.h" | 18 #include "components/autofill/core/common/autofill_constants.h" |
| 18 #include "components/autofill/core/common/autofill_messages.h" | 19 #include "components/autofill/core/common/autofill_messages.h" |
| 19 #include "components/autofill/core/common/autofill_switches.h" | 20 #include "components/autofill/core/common/autofill_switches.h" |
| 20 #include "components/autofill/core/common/form_data.h" | 21 #include "components/autofill/core/common/form_data.h" |
| 21 #include "components/autofill/core/common/form_data_predictions.h" | 22 #include "components/autofill/core/common/form_data_predictions.h" |
| 22 #include "components/autofill/core/common/form_field_data.h" | 23 #include "components/autofill/core/common/form_field_data.h" |
| 23 #include "components/autofill/core/common/password_form.h" | 24 #include "components/autofill/core/common/password_form.h" |
| 24 #include "components/autofill/core/common/web_element_descriptor.h" | 25 #include "components/autofill/core/common/web_element_descriptor.h" |
| 25 #include "content/public/common/ssl_status.h" | 26 #include "content/public/common/ssl_status.h" |
| 26 #include "content/public/common/url_constants.h" | 27 #include "content/public/common/url_constants.h" |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 element.autoComplete() ? REQUIRE_AUTOCOMPLETE : REQUIRE_NONE; | 546 element.autoComplete() ? REQUIRE_AUTOCOMPLETE : REQUIRE_NONE; |
| 546 | 547 |
| 547 FormData form; | 548 FormData form; |
| 548 FormFieldData field; | 549 FormFieldData field; |
| 549 if (!FindFormAndFieldForInputElement(element, &form, &field, requirements)) { | 550 if (!FindFormAndFieldForInputElement(element, &form, &field, requirements)) { |
| 550 // If we didn't find the cached form, at least let autocomplete have a shot | 551 // If we didn't find the cached form, at least let autocomplete have a shot |
| 551 // at providing suggestions. | 552 // at providing suggestions. |
| 552 WebFormControlElementToFormField(element, EXTRACT_VALUE, &field); | 553 WebFormControlElementToFormField(element, EXTRACT_VALUE, &field); |
| 553 } | 554 } |
| 554 | 555 |
| 556 scoped_ptr<PasswordForm> password_form = CreatePasswordForm(element.form()); | |
| 557 DCHECK(password_form.get()); | |
| 558 | |
| 555 gfx::RectF bounding_box_scaled = | 559 gfx::RectF bounding_box_scaled = |
| 556 GetScaledBoundingBox(web_view_->pageScaleFactor(), &element_); | 560 GetScaledBoundingBox(web_view_->pageScaleFactor(), &element_); |
| 557 | 561 |
| 558 // Find the datalist values and send them to the browser process. | 562 // Find the datalist values and send them to the browser process. |
| 559 std::vector<base::string16> data_list_values; | 563 std::vector<base::string16> data_list_values; |
| 560 std::vector<base::string16> data_list_labels; | 564 std::vector<base::string16> data_list_labels; |
| 561 GetDataListSuggestions(element_, &data_list_values, &data_list_labels); | 565 GetDataListSuggestions(element_, &data_list_values, &data_list_labels); |
| 562 TrimStringVectorForIPC(&data_list_values); | 566 TrimStringVectorForIPC(&data_list_values); |
| 563 TrimStringVectorForIPC(&data_list_labels); | 567 TrimStringVectorForIPC(&data_list_labels); |
| 564 | 568 |
| 565 Send(new AutofillHostMsg_SetDataList(routing_id(), | 569 Send(new AutofillHostMsg_SetDataList(routing_id(), |
| 566 data_list_values, | 570 data_list_values, |
| 567 data_list_labels)); | 571 data_list_labels)); |
| 568 | 572 |
| 569 Send(new AutofillHostMsg_QueryFormFieldAutofill(routing_id(), | 573 Send(new AutofillHostMsg_QueryFormFieldAutofill(routing_id(), |
| 570 autofill_query_id_, | 574 autofill_query_id_, |
| 571 form, | 575 form, |
| 572 field, | 576 field, |
| 577 password_form.get(), | |
|
vabr (Chromium)
2014/01/13 14:46:29
You have to dereference the pointer here:
*passwor
riadh.chtara
2014/01/13 20:34:10
Done.
| |
| 573 bounding_box_scaled, | 578 bounding_box_scaled, |
| 574 display_warning_if_disabled)); | 579 display_warning_if_disabled)); |
| 575 } | 580 } |
| 576 | 581 |
| 577 void AutofillAgent::FillAutofillFormData(const WebNode& node, | 582 void AutofillAgent::FillAutofillFormData(const WebNode& node, |
| 578 int unique_id, | 583 int unique_id, |
| 579 AutofillAction action) { | 584 AutofillAction action) { |
| 580 DCHECK_GT(unique_id, 0); | 585 DCHECK_GT(unique_id, 0); |
| 581 | 586 |
| 582 static int query_counter = 0; | 587 static int query_counter = 0; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 // Only monitors dynamic forms created in the top frame. Dynamic forms | 620 // Only monitors dynamic forms created in the top frame. Dynamic forms |
| 616 // inserted in iframes are not captured yet. | 621 // inserted in iframes are not captured yet. |
| 617 if (!frame->parent()) { | 622 if (!frame->parent()) { |
| 618 password_autofill_agent_->OnDynamicFormsSeen(frame); | 623 password_autofill_agent_->OnDynamicFormsSeen(frame); |
| 619 return; | 624 return; |
| 620 } | 625 } |
| 621 } | 626 } |
| 622 } | 627 } |
| 623 | 628 |
| 624 } // namespace autofill | 629 } // namespace autofill |
| OLD | NEW |