Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 27 matching lines...) Expand all Loading... | |
| 38 import org.chromium.chrome.browser.profiles.Profile; | 38 import org.chromium.chrome.browser.profiles.Profile; |
| 39 import org.chromium.chrome.browser.tab.Tab; | 39 import org.chromium.chrome.browser.tab.Tab; |
| 40 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; | 40 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; |
| 41 import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; | 41 import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; |
| 42 import org.chromium.chrome.browser.tabmodel.TabModel; | 42 import org.chromium.chrome.browser.tabmodel.TabModel; |
| 43 import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; | 43 import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; |
| 44 import org.chromium.chrome.browser.tabmodel.TabModelObserver; | 44 import org.chromium.chrome.browser.tabmodel.TabModelObserver; |
| 45 import org.chromium.chrome.browser.tabmodel.TabModelSelector; | 45 import org.chromium.chrome.browser.tabmodel.TabModelSelector; |
| 46 import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; | 46 import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; |
| 47 import org.chromium.components.payments.CurrencyFormatter; | 47 import org.chromium.components.payments.CurrencyFormatter; |
| 48 import org.chromium.components.payments.JourneyLogger; | |
| 49 import org.chromium.components.payments.PaymentValidator; | 48 import org.chromium.components.payments.PaymentValidator; |
| 50 import org.chromium.components.url_formatter.UrlFormatter; | 49 import org.chromium.components.url_formatter.UrlFormatter; |
| 51 import org.chromium.content_public.browser.RenderFrameHost; | 50 import org.chromium.content_public.browser.RenderFrameHost; |
| 52 import org.chromium.content_public.browser.WebContents; | 51 import org.chromium.content_public.browser.WebContents; |
| 53 import org.chromium.content_public.browser.WebContentsStatics; | 52 import org.chromium.content_public.browser.WebContentsStatics; |
| 54 import org.chromium.mojo.system.MojoException; | 53 import org.chromium.mojo.system.MojoException; |
| 55 import org.chromium.payments.mojom.CanMakePaymentQueryResult; | 54 import org.chromium.payments.mojom.CanMakePaymentQueryResult; |
| 56 import org.chromium.payments.mojom.PaymentComplete; | 55 import org.chromium.payments.mojom.PaymentComplete; |
| 57 import org.chromium.payments.mojom.PaymentDetails; | 56 import org.chromium.payments.mojom.PaymentDetails; |
| 58 import org.chromium.payments.mojom.PaymentDetailsModifier; | 57 import org.chromium.payments.mojom.PaymentDetailsModifier; |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 | 373 |
| 375 mApps = new ArrayList<>(); | 374 mApps = new ArrayList<>(); |
| 376 | 375 |
| 377 mAddressEditor = new AddressEditor(); | 376 mAddressEditor = new AddressEditor(); |
| 378 mCardEditor = new CardEditor(mWebContents, mAddressEditor, sObserverForT est); | 377 mCardEditor = new CardEditor(mWebContents, mAddressEditor, sObserverForT est); |
| 379 | 378 |
| 380 ChromeActivity activity = ChromeActivity.fromWebContents(mWebContents); | 379 ChromeActivity activity = ChromeActivity.fromWebContents(mWebContents); |
| 381 mIsIncognito = activity != null && activity.getCurrentTabModel() != null | 380 mIsIncognito = activity != null && activity.getCurrentTabModel() != null |
| 382 && activity.getCurrentTabModel().isIncognito(); | 381 && activity.getCurrentTabModel().isIncognito(); |
| 383 | 382 |
| 384 mJourneyLogger = new JourneyLogger(mIsIncognito); | 383 mJourneyLogger = new JourneyLogger(mIsIncognito, mOriginForDisplay); |
|
Mathieu
2017/04/10 01:03:01
I feel like we are tying two things that shouldn't
sebsg
2017/04/10 15:30:28
Done.
| |
| 385 | 384 |
| 386 if (sCanMakePaymentQueries == null) sCanMakePaymentQueries = new ArrayMa p<>(); | 385 if (sCanMakePaymentQueries == null) sCanMakePaymentQueries = new ArrayMa p<>(); |
| 387 | 386 |
| 388 recordSuccessFunnelHistograms("Initiated"); | 387 recordSuccessFunnelHistograms("Initiated"); |
| 389 } | 388 } |
| 390 | 389 |
| 391 @Override | 390 @Override |
| 392 protected void finalize() throws Throwable { | 391 protected void finalize() throws Throwable { |
| 393 super.finalize(); | 392 super.finalize(); |
| 394 if (mCurrencyFormatter != null) { | 393 if (mCurrencyFormatter != null) { |
| (...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1687 | 1686 |
| 1688 /** | 1687 /** |
| 1689 * The frecency score is calculated according to use count and last use date . The formula is | 1688 * 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. | 1689 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. |
| 1691 */ | 1690 */ |
| 1692 private static final double getFrecencyScore(int count, long date) { | 1691 private static final double getFrecencyScore(int count, long date) { |
| 1693 long currentTime = System.currentTimeMillis(); | 1692 long currentTime = System.currentTimeMillis(); |
| 1694 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat h.log(count + 2); | 1693 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat h.log(count + 2); |
| 1695 } | 1694 } |
| 1696 } | 1695 } |
| OLD | NEW |