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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/UrlUtilities.java

Issue 785163002: [Android] Add a check function for intent fallback navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/UrlUtilitiesTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/UrlUtilitiesTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698