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/core/browser/autofill_manager.h" | 5 #include "components/autofill/core/browser/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 if (!user_did_edit_autofilled_field_) { | 347 if (!user_did_edit_autofilled_field_) { |
348 user_did_edit_autofilled_field_ = true; | 348 user_did_edit_autofilled_field_ = true; |
349 metric_logger_->LogUserHappinessMetric( | 349 metric_logger_->LogUserHappinessMetric( |
350 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE); | 350 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE); |
351 } | 351 } |
352 } | 352 } |
353 | 353 |
354 UpdateInitialInteractionTimestamp(timestamp); | 354 UpdateInitialInteractionTimestamp(timestamp); |
355 } | 355 } |
356 | 356 |
357 void AutofillManager::OnQueryFormFieldAutofill(int query_id, | 357 void AutofillManager::OnQueryFormFieldAutofill( |
358 const FormData& form, | 358 int query_id, |
359 const FormFieldData& field, | 359 const FormData& form, |
360 const gfx::RectF& bounding_box, | 360 const FormFieldData& field, |
361 bool display_warning) { | 361 const PasswordForm& password_form, |
| 362 const gfx::RectF& bounding_box, |
| 363 bool display_warning) { |
362 std::vector<base::string16> values; | 364 std::vector<base::string16> values; |
363 std::vector<base::string16> labels; | 365 std::vector<base::string16> labels; |
364 std::vector<base::string16> icons; | 366 std::vector<base::string16> icons; |
365 std::vector<int> unique_ids; | 367 std::vector<int> unique_ids; |
366 | 368 |
367 external_delegate_->OnQuery(query_id, | 369 external_delegate_->OnQuery( |
368 form, | 370 query_id, form, field, password_form, bounding_box, display_warning); |
369 field, | |
370 bounding_box, | |
371 display_warning); | |
372 | 371 |
373 RenderViewHost* host = NULL; | 372 RenderViewHost* host = NULL; |
374 FormStructure* form_structure = NULL; | 373 FormStructure* form_structure = NULL; |
375 AutofillField* autofill_field = NULL; | 374 AutofillField* autofill_field = NULL; |
376 if (GetHost(&host) && | 375 if (GetHost(&host) && |
377 GetCachedFormAndField(form, field, &form_structure, &autofill_field) && | 376 GetCachedFormAndField(form, field, &form_structure, &autofill_field) && |
378 // Don't send suggestions for forms that aren't auto-fillable. | 377 // Don't send suggestions for forms that aren't auto-fillable. |
379 form_structure->IsAutofillable(false)) { | 378 form_structure->IsAutofillable(false)) { |
380 AutofillType type = autofill_field->Type(); | 379 AutofillType type = autofill_field->Type(); |
381 bool is_filling_credit_card = (type.group() == CREDIT_CARD); | 380 bool is_filling_credit_card = (type.group() == CREDIT_CARD); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 } | 604 } |
606 | 605 |
607 void AutofillManager::OnAddPasswordFormMapping( | 606 void AutofillManager::OnAddPasswordFormMapping( |
608 const FormFieldData& form, | 607 const FormFieldData& form, |
609 const PasswordFormFillData& fill_data) { | 608 const PasswordFormFillData& fill_data) { |
610 external_delegate_->AddPasswordFormMapping(form, fill_data); | 609 external_delegate_->AddPasswordFormMapping(form, fill_data); |
611 } | 610 } |
612 | 611 |
613 void AutofillManager::OnShowPasswordSuggestions( | 612 void AutofillManager::OnShowPasswordSuggestions( |
614 const FormFieldData& field, | 613 const FormFieldData& field, |
| 614 const PasswordForm& password_form, |
615 const gfx::RectF& bounds, | 615 const gfx::RectF& bounds, |
616 const std::vector<base::string16>& suggestions, | 616 const std::vector<base::string16>& suggestions, |
617 const std::vector<base::string16>& realms) { | 617 const std::vector<base::string16>& realms) { |
618 external_delegate_->OnShowPasswordSuggestions(suggestions, | 618 external_delegate_->OnShowPasswordSuggestions( |
619 realms, | 619 suggestions, realms, field, password_form, bounds); |
620 field, | |
621 bounds); | |
622 } | 620 } |
623 | 621 |
624 void AutofillManager::OnSetDataList(const std::vector<base::string16>& values, | 622 void AutofillManager::OnSetDataList(const std::vector<base::string16>& values, |
625 const std::vector<base::string16>& labels) { | 623 const std::vector<base::string16>& labels) { |
626 if (values.size() != labels.size()) | 624 if (values.size() != labels.size()) |
627 return; | 625 return; |
628 | 626 |
629 external_delegate_->SetCurrentDataListValues(values, labels); | 627 external_delegate_->SetCurrentDataListValues(values, labels); |
630 } | 628 } |
631 | 629 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 return false; | 1109 return false; |
1112 | 1110 |
1113 // Disregard forms that we wouldn't ever autofill in the first place. | 1111 // Disregard forms that we wouldn't ever autofill in the first place. |
1114 if (!form.ShouldBeParsed(true)) | 1112 if (!form.ShouldBeParsed(true)) |
1115 return false; | 1113 return false; |
1116 | 1114 |
1117 return true; | 1115 return true; |
1118 } | 1116 } |
1119 | 1117 |
1120 } // namespace autofill | 1118 } // namespace autofill |
OLD | NEW |