Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUiErrorView.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUiErrorView.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUiErrorView.java |
| index 12097c088fd4d30ab7208eb769b7603faa3c774d..a21004554484c236233944b20eddafe63d923b4a 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUiErrorView.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUiErrorView.java |
| @@ -16,7 +16,10 @@ import android.widget.TextView; |
| import org.chromium.base.ApiCompatibilityUtils; |
| import org.chromium.chrome.R; |
| +import org.chromium.chrome.browser.UrlConstants; |
| import org.chromium.chrome.browser.widget.BoundedLinearLayout; |
| +import org.chromium.chrome.browser.widget.TintedDrawable; |
| +import org.chromium.components.url_formatter.UrlFormatter; |
| /** |
| * Displays the status of a payment request to the user. |
| @@ -35,7 +38,23 @@ public class PaymentRequestUiErrorView extends BoundedLinearLayout { |
| */ |
| public void initialize(String title, String origin) { |
| ((TextView) findViewById(R.id.page_title)).setText(title); |
| - ((TextView) findViewById(R.id.hostname)).setText(origin); |
| + |
| + TextView hostName = (TextView) findViewById(R.id.hostname); |
|
gone
2017/02/16 19:18:57
This code is duplicated. Put it somewhere common.
gogerald1
2017/02/17 00:44:46
Done.
|
| + if (origin.startsWith(UrlConstants.HTTPS_SCHEME)) { |
| + // Tint https scheme and add compound drawable for security display. |
| + hostName.setText(UrlFormatter.tintUrlSchemeForSecurityDisplay( |
| + origin, ApiCompatibilityUtils.getColor( |
| + getContext().getResources(), R.color.google_green_700))); |
| + ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(hostName, |
| + TintedDrawable.constructTintedDrawable(getContext().getResources(), |
| + R.drawable.omnibox_https_valid, R.color.google_green_700), |
| + null, null, null); |
| + // Remove left padding to align left compound drawable with the title. Note that the |
| + // left compound drawable has transparent boundary. |
| + hostName.setPaddingRelative(0, 0, 0, 0); |
| + } else { |
| + hostName.setText(origin); |
| + } |
| // Remove the close button, then expand the page information to take up the space formerly |
| // occupied by the X. |