Bug 1035131 - Decode user entered URLs to exclude from suggested sites (r=mfinkle)

This commit is contained in:
Lucas Rocha
2014-07-07 15:59:53 +01:00
parent 344800f269
commit 00f075b6e3
2 changed files with 15 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import android.text.TextUtils;
public class StringUtils {
private static final String FILTER_URL_PREFIX = "filter://";
private static final String USER_ENTERED_URL_PREFIX = "user-entered:";
/*
* This method tries to guess if the given string could be a search query or URL,
@@ -161,6 +162,10 @@ public class StringUtils {
"file".equals(scheme) || "resource".equals(scheme));
}
public static boolean isUserEnteredUrl(String url) {
return (url != null && url.startsWith(USER_ENTERED_URL_PREFIX));
}
/**
* Given a url with a user-entered scheme, extract the
* scheme-specific component. For e.g, given "user-entered://www.google.com",