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

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

Issue 2607043002: [Autofill] Credit Card Autofill Last Used Date Experiment (Closed)
Patch Set: Added variations to show expiration date and detail time info Created 3 years, 11 months 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/personal_data_manager.h" 5 #include "components/autofill/core/browser/personal_data_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 database_->AddObserver(this); 294 database_->AddObserver(this);
295 295
296 // Check if profile cleanup has already been performed this major version. 296 // Check if profile cleanup has already been performed this major version.
297 is_autofill_profile_cleanup_pending_ = 297 is_autofill_profile_cleanup_pending_ =
298 pref_service_->GetInteger(prefs::kAutofillLastVersionDeduped) >= 298 pref_service_->GetInteger(prefs::kAutofillLastVersionDeduped) >=
299 atoi(version_info::GetVersionNumber().c_str()); 299 atoi(version_info::GetVersionNumber().c_str());
300 DVLOG(1) << "Autofill profile cleanup " 300 DVLOG(1) << "Autofill profile cleanup "
301 << (is_autofill_profile_cleanup_pending_ ? "needs to be" 301 << (is_autofill_profile_cleanup_pending_ ? "needs to be"
302 : "has already been") 302 : "has already been")
303 << " performed for this version"; 303 << " performed for this version";
Jared Saul 2017/01/18 18:43:44 I assume none of these changes are you...is it bec
jiahuiguo 2017/01/18 22:18:13 No, I did not change this. It is in the original r
304 } 304 }
305 305
306 PersonalDataManager::~PersonalDataManager() { 306 PersonalDataManager::~PersonalDataManager() {
307 CancelPendingQuery(&pending_profiles_query_); 307 CancelPendingQuery(&pending_profiles_query_);
308 CancelPendingQuery(&pending_server_profiles_query_); 308 CancelPendingQuery(&pending_server_profiles_query_);
309 CancelPendingQuery(&pending_creditcards_query_); 309 CancelPendingQuery(&pending_creditcards_query_);
310 CancelPendingQuery(&pending_server_creditcards_query_); 310 CancelPendingQuery(&pending_server_creditcards_query_);
311 311
312 if (database_.get()) 312 if (database_.get())
313 database_->RemoveObserver(this); 313 database_->RemoveObserver(this);
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 suggestion->backend_id = credit_card->guid(); 1626 suggestion->backend_id = credit_card->guid();
1627 suggestion->match = prefix_matched_suggestion 1627 suggestion->match = prefix_matched_suggestion
1628 ? Suggestion::PREFIX_MATCH 1628 ? Suggestion::PREFIX_MATCH
1629 : Suggestion::SUBSTRING_MATCH; 1629 : Suggestion::SUBSTRING_MATCH;
1630 1630
1631 // If the value is the card number, the label is the expiration date. 1631 // If the value is the card number, the label is the expiration date.
1632 // Otherwise the label is the card number, or if that is empty the 1632 // Otherwise the label is the card number, or if that is empty the
1633 // cardholder name. The label should never repeat the value. 1633 // cardholder name. The label should never repeat the value.
1634 if (type.GetStorableType() == CREDIT_CARD_NUMBER) { 1634 if (type.GetStorableType() == CREDIT_CARD_NUMBER) {
1635 suggestion->value = credit_card->TypeAndLastFourDigits(); 1635 suggestion->value = credit_card->TypeAndLastFourDigits();
1636 suggestion->label = credit_card->GetInfo( 1636 if (IsAutofillCreditCardLastUsedDateDisplayExperimentEnabled() &&
1637 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_); 1637 !IsKeyboardAccessoryEnabled()) {
1638 if (ShowExpirationDateInAutofillCreditCardLastUsedDate()) {
1639 suggestion->label = credit_card->GetInfo(
1640 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_);
1641 }
1642 if (suggestion->label.empty()) {
1643 suggestion->label = credit_card->LastUsedDateAsString(
1644 ShowDetailedTimeInfoInAutofillCreditCardLastUsedDate(),
1645 ShowExpirationDateInAutofillCreditCardLastUsedDate(),
1646 app_locale_);
1647 } else {
1648 suggestion->label.append(credit_card->LastUsedDateAsString(
1649 ShowDetailedTimeInfoInAutofillCreditCardLastUsedDate(),
1650 ShowExpirationDateInAutofillCreditCardLastUsedDate(),
1651 app_locale_));
1652 }
1653 } else {
1654 suggestion->label = credit_card->GetInfo(
1655 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_);
1656 }
1638 if (IsAutofillCreditCardPopupLayoutExperimentEnabled()) 1657 if (IsAutofillCreditCardPopupLayoutExperimentEnabled())
1639 ModifyAutofillCreditCardSuggestion(suggestion); 1658 ModifyAutofillCreditCardSuggestion(suggestion);
1640 } else if (credit_card->number().empty()) { 1659 } else if (credit_card->number().empty()) {
1641 if (type.GetStorableType() != CREDIT_CARD_NAME_FULL) { 1660 if (type.GetStorableType() != CREDIT_CARD_NAME_FULL) {
1642 suggestion->label = credit_card->GetInfo( 1661 suggestion->label = credit_card->GetInfo(
1643 AutofillType(CREDIT_CARD_NAME_FULL), app_locale_); 1662 AutofillType(CREDIT_CARD_NAME_FULL), app_locale_);
1644 } 1663 }
1645 } else { 1664 } else {
1646 #if defined(OS_ANDROID) 1665 #if defined(OS_ANDROID)
1647 // Since Android places the label on its own row, there's more 1666 // Since Android places the label on its own row, there's more
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 } 1880 }
1862 1881
1863 // If the card was modified, apply the changes to the database. 1882 // If the card was modified, apply the changes to the database.
1864 if (was_modified) { 1883 if (was_modified) {
1865 database_->UpdateCreditCard(*credit_card); 1884 database_->UpdateCreditCard(*credit_card);
1866 } 1885 }
1867 } 1886 }
1868 } 1887 }
1869 1888
1870 } // namespace autofill 1889 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698