| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestHeader.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestHeader.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestHeader.java
|
| index 4907bc14a1d9963d903414547a7e58ad3eb9d2d6..0aa0132cb173948441c68352ff4f57acdabf14f6 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestHeader.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestHeader.java
|
| @@ -7,8 +7,7 @@ package org.chromium.chrome.browser.payments.ui;
|
| import android.content.Context;
|
| import android.graphics.Bitmap;
|
| import android.text.Spannable;
|
| -import android.text.SpannableString;
|
| -import android.text.style.ForegroundColorSpan;
|
| +import android.text.SpannableStringBuilder;
|
| import android.util.AttributeSet;
|
| import android.widget.FrameLayout;
|
| import android.widget.ImageView;
|
| @@ -17,6 +16,8 @@ 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.omnibox.OmniboxUrlEmphasizer;
|
| +import org.chromium.chrome.browser.profiles.Profile;
|
| import org.chromium.chrome.browser.widget.TintedDrawable;
|
|
|
| /** This class represents a bar to display at the top of the payment request UI. */
|
| @@ -41,16 +42,22 @@ public class PaymentRequestHeader extends FrameLayout {
|
| /**
|
| * Sets the title and origin on the header.
|
| *
|
| - * @param title The title to display on the header.
|
| - * @param origin The origin to display on the header.
|
| + * @param title The title to display on the header.
|
| + * @param origin The origin to display on the header.
|
| + * @param securityLevel The security level of the page that invoked PaymentRequest.
|
| */
|
| - public void setTitleAndOrigin(String title, String origin) {
|
| + public void setTitleAndOrigin(String title, String origin, int securityLevel) {
|
| ((TextView) findViewById(R.id.page_title)).setText(title);
|
|
|
| TextView hostName = (TextView) findViewById(R.id.hostname);
|
| + Spannable url = new SpannableStringBuilder(origin);
|
| + OmniboxUrlEmphasizer.emphasizeUrl(url, mContext.getResources(),
|
| + Profile.getLastUsedProfile(), securityLevel, false /* isInternalPage */,
|
| + true /* useDarkColors */, true /* emphasizeHttpsScheme */);
|
| + hostName.setText(url);
|
| +
|
| if (origin.startsWith(UrlConstants.HTTPS_URL_PREFIX)) {
|
| - // Tint https scheme and add compound drawable for security display.
|
| - hostName.setText(tintUrlSchemeForSecurityDisplay(origin));
|
| + // Add a lock icon.
|
| ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(hostName,
|
| TintedDrawable.constructTintedDrawable(mContext.getResources(),
|
| R.drawable.omnibox_https_valid, R.color.google_green_700),
|
| @@ -59,17 +66,6 @@ public class PaymentRequestHeader extends FrameLayout {
|
| // 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);
|
| }
|
| }
|
| -
|
| - private CharSequence tintUrlSchemeForSecurityDisplay(String uri) {
|
| - SpannableString spannableUri = new SpannableString(uri);
|
| - int color =
|
| - ApiCompatibilityUtils.getColor(mContext.getResources(), R.color.google_green_700);
|
| - spannableUri.setSpan(new ForegroundColorSpan(color), 0,
|
| - spannableUri.toString().indexOf(":"), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
| - return spannableUri;
|
| - }
|
| }
|
|
|