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 <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "components/autofill/core/browser/field_types.h" | 42 #include "components/autofill/core/browser/field_types.h" |
43 #include "components/autofill/core/browser/form_structure.h" | 43 #include "components/autofill/core/browser/form_structure.h" |
44 #include "components/autofill/core/browser/personal_data_manager.h" | 44 #include "components/autofill/core/browser/personal_data_manager.h" |
45 #include "components/autofill/core/browser/phone_number.h" | 45 #include "components/autofill/core/browser/phone_number.h" |
46 #include "components/autofill/core/browser/phone_number_i18n.h" | 46 #include "components/autofill/core/browser/phone_number_i18n.h" |
47 #include "components/autofill/core/browser/popup_item_ids.h" | 47 #include "components/autofill/core/browser/popup_item_ids.h" |
48 #include "components/autofill/core/common/autofill_constants.h" | 48 #include "components/autofill/core/common/autofill_constants.h" |
49 #include "components/autofill/core/common/autofill_data_validation.h" | 49 #include "components/autofill/core/common/autofill_data_validation.h" |
50 #include "components/autofill/core/common/autofill_pref_names.h" | 50 #include "components/autofill/core/common/autofill_pref_names.h" |
51 #include "components/autofill/core/common/autofill_switches.h" | 51 #include "components/autofill/core/common/autofill_switches.h" |
| 52 #include "components/autofill/core/common/autofill_util.h" |
52 #include "components/autofill/core/common/form_data.h" | 53 #include "components/autofill/core/common/form_data.h" |
53 #include "components/autofill/core/common/form_data_predictions.h" | 54 #include "components/autofill/core/common/form_data_predictions.h" |
54 #include "components/autofill/core/common/form_field_data.h" | 55 #include "components/autofill/core/common/form_field_data.h" |
55 #include "components/autofill/core/common/password_form_fill_data.h" | 56 #include "components/autofill/core/common/password_form_fill_data.h" |
56 #include "components/pref_registry/pref_registry_syncable.h" | 57 #include "components/pref_registry/pref_registry_syncable.h" |
57 #include "google_apis/gaia/identity_provider.h" | 58 #include "google_apis/gaia/identity_provider.h" |
58 #include "grit/components_strings.h" | 59 #include "grit/components_strings.h" |
59 #include "ui/base/l10n/l10n_util.h" | 60 #include "ui/base/l10n/l10n_util.h" |
60 #include "ui/gfx/geometry/rect.h" | 61 #include "ui/gfx/geometry/rect.h" |
61 #include "url/gurl.h" | 62 #include "url/gurl.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 credit_card_form_event_logger_->OnDidInteractWithAutofillableForm(); | 401 credit_card_form_event_logger_->OnDidInteractWithAutofillableForm(); |
401 else | 402 else |
402 address_form_event_logger_->OnDidInteractWithAutofillableForm(); | 403 address_form_event_logger_->OnDidInteractWithAutofillableForm(); |
403 } | 404 } |
404 | 405 |
405 if (is_autofill_possible && | 406 if (is_autofill_possible && |
406 driver_->RendererIsAvailable() && | 407 driver_->RendererIsAvailable() && |
407 got_autofillable_form) { | 408 got_autofillable_form) { |
408 AutofillType type = autofill_field->Type(); | 409 AutofillType type = autofill_field->Type(); |
409 bool is_filling_credit_card = (type.group() == CREDIT_CARD); | 410 bool is_filling_credit_card = (type.group() == CREDIT_CARD); |
| 411 // On desktop, don't return non credit card related suggestions for forms or |
| 412 // fields that have the "autocomplete" attribute set to off. |
| 413 if (IsDesktopPlatform() && !is_filling_credit_card && |
| 414 !field.should_autocomplete) { |
| 415 return; |
| 416 } |
410 if (is_filling_credit_card) { | 417 if (is_filling_credit_card) { |
411 suggestions = GetCreditCardSuggestions(field, type); | 418 suggestions = GetCreditCardSuggestions(field, type); |
412 } else { | 419 } else { |
413 suggestions = | 420 suggestions = |
414 GetProfileSuggestions(*form_structure, field, *autofill_field); | 421 GetProfileSuggestions(*form_structure, field, *autofill_field); |
415 } | 422 } |
416 if (!suggestions.empty()) { | 423 if (!suggestions.empty()) { |
417 // Don't provide credit card suggestions for non-secure pages. However, | 424 // Don't provide credit card suggestions for non-secure pages. However, |
418 // do provide a warning to the user. This will generate warnings on pages | 425 // do provide a warning to the user. This will generate warnings on pages |
419 // with mixed content (which includes forms with an http target). | 426 // with mixed content (which includes forms with an http target). |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 if (i > 0) | 1638 if (i > 0) |
1632 fputs("Next oldest form:\n", file); | 1639 fputs("Next oldest form:\n", file); |
1633 } | 1640 } |
1634 fputs("\n", file); | 1641 fputs("\n", file); |
1635 | 1642 |
1636 fclose(file); | 1643 fclose(file); |
1637 } | 1644 } |
1638 #endif // ENABLE_FORM_DEBUG_DUMP | 1645 #endif // ENABLE_FORM_DEBUG_DUMP |
1639 | 1646 |
1640 } // namespace autofill | 1647 } // namespace autofill |
OLD | NEW |