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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java

Issue 2817733002: Revert of [Reland] Use dropdown list for admin areas in pr form. (Closed)
Patch Set: Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 package org.chromium.chrome.browser.payments; 5 package org.chromium.chrome.browser.payments;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.graphics.Bitmap; 10 import android.graphics.Bitmap;
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 522
523 // Limit the number of suggestions. 523 // Limit the number of suggestions.
524 addresses = addresses.subList(0, Math.min(addresses.size(), SUGGESTIONS_ LIMIT)); 524 addresses = addresses.subList(0, Math.min(addresses.size(), SUGGESTIONS_ LIMIT));
525 525
526 // Load the validation rules for each unique region code. 526 // Load the validation rules for each unique region code.
527 Set<String> uniqueCountryCodes = new HashSet<>(); 527 Set<String> uniqueCountryCodes = new HashSet<>();
528 for (int i = 0; i < addresses.size(); ++i) { 528 for (int i = 0; i < addresses.size(); ++i) {
529 String countryCode = AutofillAddress.getCountryCode(addresses.get(i) .getProfile()); 529 String countryCode = AutofillAddress.getCountryCode(addresses.get(i) .getProfile());
530 if (!uniqueCountryCodes.contains(countryCode)) { 530 if (!uniqueCountryCodes.contains(countryCode)) {
531 uniqueCountryCodes.add(countryCode); 531 uniqueCountryCodes.add(countryCode);
532 PersonalDataManager.getInstance().loadRulesForAddressNormalizati on(countryCode); 532 PersonalDataManager.getInstance().loadRulesForRegion(countryCode );
533 } 533 }
534 } 534 }
535 535
536 // Log the number of suggested shipping addresses. 536 // Log the number of suggested shipping addresses.
537 mJourneyLogger.setNumberOfSuggestionsShown( 537 mJourneyLogger.setNumberOfSuggestionsShown(
538 JourneyLogger.SECTION_SHIPPING_ADDRESS, addresses.size()); 538 JourneyLogger.SECTION_SHIPPING_ADDRESS, addresses.size());
539 539
540 // Automatically select the first address if one is complete and if the merchant does 540 // Automatically select the first address if one is complete and if the merchant does
541 // not require a shipping address to calculate shipping costs. 541 // not require a shipping address to calculate shipping costs.
542 int firstCompleteAddressIndex = SectionInformation.NO_SELECTION; 542 int firstCompleteAddressIndex = SectionInformation.NO_SELECTION;
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 // addresses and check for validity. 1380 // addresses and check for validity.
1381 Set<String> uniqueCountryCodes = new HashSet<>(); 1381 Set<String> uniqueCountryCodes = new HashSet<>();
1382 for (int i = 0; i < mPendingAutofillInstruments.size(); ++i) { 1382 for (int i = 0; i < mPendingAutofillInstruments.size(); ++i) {
1383 assert mPendingAutofillInstruments.get(i) instanceof AutofillPayment Instrument; 1383 assert mPendingAutofillInstruments.get(i) instanceof AutofillPayment Instrument;
1384 AutofillPaymentInstrument creditCard = 1384 AutofillPaymentInstrument creditCard =
1385 (AutofillPaymentInstrument) mPendingAutofillInstruments.get( i); 1385 (AutofillPaymentInstrument) mPendingAutofillInstruments.get( i);
1386 1386
1387 String countryCode = AutofillAddress.getCountryCode(creditCard.getBi llingAddress()); 1387 String countryCode = AutofillAddress.getCountryCode(creditCard.getBi llingAddress());
1388 if (!uniqueCountryCodes.contains(countryCode)) { 1388 if (!uniqueCountryCodes.contains(countryCode)) {
1389 uniqueCountryCodes.add(countryCode); 1389 uniqueCountryCodes.add(countryCode);
1390 PersonalDataManager.getInstance().loadRulesForAddressNormalizati on(countryCode); 1390 PersonalDataManager.getInstance().loadRulesForRegion(countryCode );
1391 } 1391 }
1392 1392
1393 // If there's a card on file with a valid number and a name, then 1393 // If there's a card on file with a valid number and a name, then
1394 // PaymentRequest.canMakePayment() returns true. 1394 // PaymentRequest.canMakePayment() returns true.
1395 mCanMakePayment |= creditCard.isValidCard(); 1395 mCanMakePayment |= creditCard.isValidCard();
1396 } 1396 }
1397 1397
1398 // List order: 1398 // List order:
1399 // > Non-autofill instruments. 1399 // > Non-autofill instruments.
1400 // > Complete autofill instruments. 1400 // > Complete autofill instruments.
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 1687
1688 /** 1688 /**
1689 * The frecency score is calculated according to use count and last use date . The formula is 1689 * The frecency score is calculated according to use count and last use date . The formula is
1690 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. 1690 * the same as the one used in GetFrecencyScore in autofill_data_model.cc.
1691 */ 1691 */
1692 private static final double getFrecencyScore(int count, long date) { 1692 private static final double getFrecencyScore(int count, long date) {
1693 long currentTime = System.currentTimeMillis(); 1693 long currentTime = System.currentTimeMillis();
1694 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat h.log(count + 2); 1694 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat h.log(count + 2);
1695 } 1695 }
1696 } 1696 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698