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

Unified Diff: components/url_formatter/android/java/src/org/chromium/components/url_formatter/UrlFormatter.java

Issue 2698703003: [Payments] Add UI elements to secure branding for payments (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/url_formatter/android/java/src/org/chromium/components/url_formatter/UrlFormatter.java
diff --git a/components/url_formatter/android/java/src/org/chromium/components/url_formatter/UrlFormatter.java b/components/url_formatter/android/java/src/org/chromium/components/url_formatter/UrlFormatter.java
index 98c394e171cb61b992dccbcae89efd445d0960b2..3d7ee1d73c729bb450b921176161db98f24f51dc 100644
--- a/components/url_formatter/android/java/src/org/chromium/components/url_formatter/UrlFormatter.java
+++ b/components/url_formatter/android/java/src/org/chromium/components/url_formatter/UrlFormatter.java
@@ -4,7 +4,10 @@
package org.chromium.components.url_formatter;
+import android.text.Spannable;
+import android.text.SpannableString;
import android.text.TextUtils;
+import android.text.style.ForegroundColorSpan;
import org.chromium.base.annotations.JNINamespace;
@@ -83,6 +86,21 @@ public final class UrlFormatter {
}
}
+ /**
+ * Tints the scheme of the URL to specific color for display.
+ *
+ * @param uri The URI.
please use gerrit instead 2017/02/15 21:45:02 Please align "The" together on these two lines.
gogerald1 2017/02/16 16:43:14 Done.
+ * @param color The color used to tint the scheme.
+ *
+ * @return The URL with tinted scheme.
+ */
+ public static CharSequence tintUrlSchemeForSecurityDisplay(String uri, int color) {
please use gerrit instead 2017/02/15 21:45:02 How does the omnibox tint the URL scheme? It would
please use gerrit instead 2017/02/15 21:45:02 Please pick either URL or URI and use that term th
gogerald1 2017/02/16 16:43:14 Done.
gogerald1 2017/02/16 16:43:14 They do the similar thing.
+ SpannableString spannableUri = new SpannableString(uri);
+ spannableUri.setSpan(new ForegroundColorSpan(color), 0,
+ spannableUri.toString().indexOf(":"), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
please use gerrit instead 2017/02/15 21:45:02 Please tint only "https:" scheme. Although "file:"
gogerald1 2017/02/16 16:43:14 Done.
+ return spannableUri;
+ }
+
private static native String nativeFixupUrl(String url);
private static native String nativeFormatUrlForDisplay(String url);
private static native String nativeFormatUrlForSecurityDisplay(String url);

Powered by Google App Engine
This is Rietveld 408576698