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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 SecurityStateModel.getSecurityLevelForWebContents(mWebContents), | 520 SecurityStateModel.getSecurityLevelForWebContents(mWebContents), |
521 new ShippingStrings(mShippingType)); | 521 new ShippingStrings(mShippingType)); |
522 | 522 |
523 final FaviconHelper faviconHelper = new FaviconHelper(); | 523 final FaviconHelper faviconHelper = new FaviconHelper(); |
524 faviconHelper.getLocalFaviconImageForURL(Profile.getLastUsedProfile(), | 524 faviconHelper.getLocalFaviconImageForURL(Profile.getLastUsedProfile(), |
525 mWebContents.getLastCommittedUrl(), | 525 mWebContents.getLastCommittedUrl(), |
526 activity.getResources().getDimensionPixelSize(R.dimen.payments_f avicon_size), | 526 activity.getResources().getDimensionPixelSize(R.dimen.payments_f avicon_size), |
527 new FaviconHelper.FaviconImageCallback() { | 527 new FaviconHelper.FaviconImageCallback() { |
528 @Override | 528 @Override |
529 public void onFaviconAvailable(Bitmap bitmap, String iconUrl ) { | 529 public void onFaviconAvailable(Bitmap bitmap, String iconUrl ) { |
530 if (bitmap == null) mClient.warnNoFavicon(); | |
gogerald1
2017/05/08 22:13:56
if(bitmap == null && mClient != null) mClient.warn
please use gerrit instead
2017/05/09 15:23:05
Done.
| |
530 if (mUI != null && bitmap != null) mUI.setTitleBitmap(bi tmap); | 531 if (mUI != null && bitmap != null) mUI.setTitleBitmap(bi tmap); |
531 faviconHelper.destroy(); | 532 faviconHelper.destroy(); |
532 } | 533 } |
533 }); | 534 }); |
534 | 535 |
535 // Add the callback to change the label of shipping addresses depending on the focus. | 536 // Add the callback to change the label of shipping addresses depending on the focus. |
536 if (mRequestShipping) mUI.setShippingAddressSectionFocusChangedObserver( this); | 537 if (mRequestShipping) mUI.setShippingAddressSectionFocusChangedObserver( this); |
537 | 538 |
538 mAddressEditor.setEditorView(mUI.getEditorView()); | 539 mAddressEditor.setEditorView(mUI.getEditorView()); |
539 mCardEditor.setEditorView(mUI.getCardEditorView()); | 540 mCardEditor.setEditorView(mUI.getCardEditorView()); |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1870 | 1871 |
1871 /** | 1872 /** |
1872 * The frecency score is calculated according to use count and last use date . The formula is | 1873 * The frecency score is calculated according to use count and last use date . The formula is |
1873 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. | 1874 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. |
1874 */ | 1875 */ |
1875 private static final double getFrecencyScore(int count, long date) { | 1876 private static final double getFrecencyScore(int count, long date) { |
1876 long currentTime = System.currentTimeMillis(); | 1877 long currentTime = System.currentTimeMillis(); |
1877 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat h.log(count + 2); | 1878 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat h.log(count + 2); |
1878 } | 1879 } |
1879 } | 1880 } |
OLD | NEW |