Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: components/autofill/core/browser/autofill_manager.cc

Issue 2473493002: [Autofill] Credit card signin promo: do not require a local suggestion first. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { 599 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) {
600 AutofillMetrics::LogAddressSuggestionsCount(suggestions.size()); 600 AutofillMetrics::LogAddressSuggestionsCount(suggestions.size());
601 has_logged_address_suggestions_count_ = true; 601 has_logged_address_suggestions_count_ = true;
602 } 602 }
603 } 603 }
604 } 604 }
605 } 605 }
606 606
607 // If there are no Autofill suggestions, consider showing Autocomplete 607 // If there are no Autofill suggestions, consider showing Autocomplete
608 // suggestions. We will not show Autocomplete suggestions for a field that 608 // suggestions. We will not show Autocomplete suggestions for a field that
609 // specifies autocomplete=off (or an unrecognized type) or a field that we 609 // specifies autocomplete=off (or an unrecognized type), a field for which we
610 // think is a credit card expiration, cvc or number. 610 // will show the credit card signin promo, or a field that we think is a
611 if (suggestions.empty() && field.should_autocomplete && 611 // credit card expiration, cvc or number.
612 if (suggestions.empty() && !ShouldShowCreditCardSigninPromo(form, field) &&
sebsg 2016/11/01 21:31:15 Do you think you could add a test for that?
Mathieu 2016/11/02 21:01:04 Certainly can!
613 field.should_autocomplete &&
612 !(autofill_field && 614 !(autofill_field &&
613 (IsCreditCardExpirationType(autofill_field->Type().GetStorableType()) || 615 (IsCreditCardExpirationType(autofill_field->Type().GetStorableType()) ||
614 autofill_field->Type().html_type() == HTML_TYPE_UNRECOGNIZED || 616 autofill_field->Type().html_type() == HTML_TYPE_UNRECOGNIZED ||
615 autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER || 617 autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER ||
616 autofill_field->Type().GetStorableType() == 618 autofill_field->Type().GetStorableType() ==
617 CREDIT_CARD_VERIFICATION_CODE))) { 619 CREDIT_CARD_VERIFICATION_CODE))) {
618 // Suggestions come back asynchronously, so the Autocomplete manager will 620 // Suggestions come back asynchronously, so the Autocomplete manager will
619 // handle sending the results back to the renderer. 621 // handle sending the results back to the renderer.
620 autocomplete_history_manager_->OnGetAutocompleteSuggestions( 622 autocomplete_history_manager_->OnGetAutocompleteSuggestions(
621 query_id, field.name, field.value, field.form_control_type); 623 query_id, field.name, field.value, field.form_control_type);
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 if (i > 0) 2090 if (i > 0)
2089 fputs("Next oldest form:\n", file); 2091 fputs("Next oldest form:\n", file);
2090 } 2092 }
2091 fputs("\n", file); 2093 fputs("\n", file);
2092 2094
2093 fclose(file); 2095 fclose(file);
2094 } 2096 }
2095 #endif // ENABLE_FORM_DEBUG_DUMP 2097 #endif // ENABLE_FORM_DEBUG_DUMP
2096 2098
2097 } // namespace autofill 2099 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698