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/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 28 matching lines...) Expand all Loading... | |
| 39 #include "components/autofill/core/common/autofill_pref_names.h" | 39 #include "components/autofill/core/common/autofill_pref_names.h" |
| 40 #include "components/autofill/core/common/autofill_switches.h" | 40 #include "components/autofill/core/common/autofill_switches.h" |
| 41 #include "components/autofill/core/common/form_data.h" | 41 #include "components/autofill/core/common/form_data.h" |
| 42 #include "components/autofill/core/common/form_data_predictions.h" | 42 #include "components/autofill/core/common/form_data_predictions.h" |
| 43 #include "components/autofill/core/common/form_field_data.h" | 43 #include "components/autofill/core/common/form_field_data.h" |
| 44 #include "components/autofill/core/common/password_form_fill_data.h" | 44 #include "components/autofill/core/common/password_form_fill_data.h" |
| 45 #include "components/user_prefs/pref_registry_syncable.h" | 45 #include "components/user_prefs/pref_registry_syncable.h" |
| 46 #include "content/public/browser/web_contents.h" | 46 #include "content/public/browser/web_contents.h" |
| 47 #include "grit/component_strings.h" | 47 #include "grit/component_strings.h" |
| 48 #include "third_party/WebKit/public/web/WebAutofillClient.h" | 48 #include "third_party/WebKit/public/web/WebAutofillClient.h" |
| 49 #include "third_party/WebKit/public/web/WebFormElement.h" | |
| 49 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
| 50 #include "ui/gfx/rect.h" | 51 #include "ui/gfx/rect.h" |
| 51 #include "url/gurl.h" | 52 #include "url/gurl.h" |
| 52 | 53 |
| 53 namespace autofill { | 54 namespace autofill { |
| 54 | 55 |
| 55 typedef PersonalDataManager::GUIDPair GUIDPair; | 56 typedef PersonalDataManager::GUIDPair GUIDPair; |
| 56 | 57 |
| 57 using base::TimeTicks; | 58 using base::TimeTicks; |
| 58 using content::RenderViewHost; | 59 using content::RenderViewHost; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 user_did_edit_autofilled_field_ = true; | 349 user_did_edit_autofilled_field_ = true; |
| 349 metric_logger_->LogUserHappinessMetric( | 350 metric_logger_->LogUserHappinessMetric( |
| 350 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE); | 351 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE); |
| 351 } | 352 } |
| 352 } | 353 } |
| 353 | 354 |
| 354 UpdateInitialInteractionTimestamp(timestamp); | 355 UpdateInitialInteractionTimestamp(timestamp); |
| 355 } | 356 } |
| 356 | 357 |
| 357 void AutofillManager::OnQueryFormFieldAutofill(int query_id, | 358 void AutofillManager::OnQueryFormFieldAutofill(int query_id, |
| 358 const FormData& form, | 359 const FormData& form, |
|
vabr (Chromium)
2014/01/10 18:40:00
Wrong indentation, should match the column positio
| |
| 359 const FormFieldData& field, | 360 const FormFieldData& field, |
| 360 const gfx::RectF& bounding_box, | 361 const blink::WebFormElement& webformelement, |
| 361 bool display_warning) { | 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(query_id, |
| 368 form, | 370 form, |
| 369 field, | 371 field, |
| 372 webformelement, | |
| 370 bounding_box, | 373 bounding_box, |
| 371 display_warning); | 374 display_warning); |
| 372 | 375 |
| 373 RenderViewHost* host = NULL; | 376 RenderViewHost* host = NULL; |
| 374 FormStructure* form_structure = NULL; | 377 FormStructure* form_structure = NULL; |
| 375 AutofillField* autofill_field = NULL; | 378 AutofillField* autofill_field = NULL; |
| 376 if (GetHost(&host) && | 379 if (GetHost(&host) && |
| 377 GetCachedFormAndField(form, field, &form_structure, &autofill_field) && | 380 GetCachedFormAndField(form, field, &form_structure, &autofill_field) && |
| 378 // Don't send suggestions for forms that aren't auto-fillable. | 381 // Don't send suggestions for forms that aren't auto-fillable. |
| 379 form_structure->IsAutofillable(false)) { | 382 form_structure->IsAutofillable(false)) { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 605 } | 608 } |
| 606 | 609 |
| 607 void AutofillManager::OnAddPasswordFormMapping( | 610 void AutofillManager::OnAddPasswordFormMapping( |
| 608 const FormFieldData& form, | 611 const FormFieldData& form, |
| 609 const PasswordFormFillData& fill_data) { | 612 const PasswordFormFillData& fill_data) { |
| 610 external_delegate_->AddPasswordFormMapping(form, fill_data); | 613 external_delegate_->AddPasswordFormMapping(form, fill_data); |
| 611 } | 614 } |
| 612 | 615 |
| 613 void AutofillManager::OnShowPasswordSuggestions( | 616 void AutofillManager::OnShowPasswordSuggestions( |
| 614 const FormFieldData& field, | 617 const FormFieldData& field, |
| 618 const blink::WebFormElement& element, | |
| 615 const gfx::RectF& bounds, | 619 const gfx::RectF& bounds, |
| 616 const std::vector<base::string16>& suggestions, | 620 const std::vector<base::string16>& suggestions, |
| 617 const std::vector<base::string16>& realms) { | 621 const std::vector<base::string16>& realms) { |
| 618 external_delegate_->OnShowPasswordSuggestions(suggestions, | 622 external_delegate_->OnShowPasswordSuggestions(suggestions, |
| 623 element, | |
| 619 realms, | 624 realms, |
| 620 field, | 625 field, |
| 621 bounds); | 626 bounds); |
| 622 } | 627 } |
| 623 | 628 |
| 624 void AutofillManager::OnSetDataList(const std::vector<base::string16>& values, | 629 void AutofillManager::OnSetDataList(const std::vector<base::string16>& values, |
| 625 const std::vector<base::string16>& labels) { | 630 const std::vector<base::string16>& labels) { |
| 626 if (values.size() != labels.size()) | 631 if (values.size() != labels.size()) |
| 627 return; | 632 return; |
| 628 | 633 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1111 return false; | 1116 return false; |
| 1112 | 1117 |
| 1113 // Disregard forms that we wouldn't ever autofill in the first place. | 1118 // Disregard forms that we wouldn't ever autofill in the first place. |
| 1114 if (!form.ShouldBeParsed(true)) | 1119 if (!form.ShouldBeParsed(true)) |
| 1115 return false; | 1120 return false; |
| 1116 | 1121 |
| 1117 return true; | 1122 return true; |
| 1118 } | 1123 } |
| 1119 | 1124 |
| 1120 } // namespace autofill | 1125 } // namespace autofill |
| OLD | NEW |