Chromium Code Reviews| 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 4ae65c0df987881a8e9d8e84fc857ea00a04b0f6..ce2ad72d06c59ea5673cccdea198a8107fd86385 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/UrlUtilities.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/UrlUtilities.java |
| @@ -37,6 +37,12 @@ public class UrlUtilities { |
| "chrome", "chrome-native", "about"); |
| /** |
| + * URI schemes that can be handled in Intent fallback navigation. |
| + */ |
| + private static final HashSet<String> FALLBACK_VALID_SCHEMES = CollectionUtil.newHashSet( |
| + "http", "https"); |
| + |
| + /** |
| * @param uri A URI. |
| * |
| * @return True if the URI's scheme is one that ContentView can handle. |
| @@ -61,6 +67,28 @@ public class UrlUtilities { |
| /** |
| * @param uri A URI. |
| * |
| + * @return True if the URI is valid for Intent fallback navigation. |
| + */ |
| + public static boolean isValidForIntentFallbackNavigation(URI uri) { |
| + return FALLBACK_VALID_SCHEMES.contains(uri.getScheme()); |
| + } |
| + |
| + /** |
| + * @param uri A URI. |
| + * |
| + * @return True if the URI is valid for Intent fallback navigation. |
| + */ |
| + public static boolean isValidForIntentFallbackNavigation(String uri) { |
|
palmer
2014/12/09 22:04:26
Arguably, *this* method's caller should do new URI
|
| + try { |
| + return isValidForIntentFallbackNavigation(new URI(uri)); |
| + } catch (URISyntaxException e) { |
| + return false; |
| + } |
| + } |
| + |
| + /** |
| + * @param uri A URI. |
| + * |
| * @return True if the URI's scheme is one that Chrome can download. |
| */ |
| public static boolean isDownloadableScheme(URI uri) { |