| Index: chrome/android/java/src/org/chromium/chrome/browser/UrlUtilities.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/UrlUtilities.java b/chrome/android/java/src/org/chromium/chrome/browser/UrlUtilities.java
|
| index bbd359fdfd80d75dea256ea5aafd5e7c356194ba..27ed1dd7db83ca38abe37651a44f790ccc07194d 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/UrlUtilities.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/UrlUtilities.java
|
| @@ -147,30 +147,12 @@ public class UrlUtilities {
|
| * @return Stripped-down String containing the essential bits of the URL, or the original URL if
|
| * it fails to parse it.
|
| */
|
| - public static String getOriginForDisplay(URI uri, boolean showScheme) {
|
| - String scheme = uri.getScheme();
|
| - String host = uri.getHost();
|
| - int port = uri.getPort();
|
| -
|
| - String displayUrl;
|
| - if (TextUtils.isEmpty(scheme) || TextUtils.isEmpty(host)) {
|
| - displayUrl = uri.toString();
|
| + public static String formatUrlForSecurityDisplay(URI uri, boolean showScheme) {
|
| + if (showScheme) {
|
| + return nativeFormatUrlForSecurityDisplay(uri.toString());
|
| } else {
|
| - if (showScheme) {
|
| - scheme += "://";
|
| - } else {
|
| - scheme = "";
|
| - }
|
| -
|
| - if (port == -1 || (port == 80 && "http".equals(scheme))
|
| - || (port == 443 && "https".equals(scheme))) {
|
| - displayUrl = scheme + host;
|
| - } else {
|
| - displayUrl = scheme + host + ":" + port;
|
| - }
|
| + return nativeFormatUrlForSecurityDisplayOmitScheme(uri.toString());
|
| }
|
| -
|
| - return displayUrl;
|
| }
|
|
|
| /**
|
| @@ -380,5 +362,7 @@ public class UrlUtilities {
|
| boolean includePrivateRegistries);
|
| public static native boolean nativeIsGoogleSearchUrl(String url);
|
| public static native boolean nativeIsGoogleHomePageUrl(String url);
|
| + public static native String nativeFormatUrlForSecurityDisplay(String url);
|
| + public static native String nativeFormatUrlForSecurityDisplayOmitScheme(String url);
|
| private static native String nativeFixupUrl(String url, String desiredTld);
|
| }
|
|
|