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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java

Issue 2524843003: WebView: Add scheme whitelist for content intents. (Closed)
Patch Set: Created 4 years, 1 month 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 | « android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
index a487cfee3e3765a9612bb62ca83b7b3390bc7537..b456ba18772a39648e67c72792355938334227d3 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
@@ -85,6 +85,17 @@ public class ContentViewClient {
}
/**
+ * Check whether the given scheme is one of the acceptable schemes for onStartContentIntent.
+ *
+ * @param scheme The scheme to check.
+ * @return true if the scheme is okay, false if it should be blocked.
+ */
+ protected boolean isAcceptableContentIntentScheme(String scheme) {
+ return GEO_SCHEME.equals(scheme) || TEL_SCHEME.equals(scheme)
+ || MAILTO_SCHEME.equals(scheme);
+ }
+
+ /**
* Called when a new content intent is requested to be started.
*/
public void onStartContentIntent(Context context, String intentUrl, boolean isMainFrame) {
@@ -94,8 +105,7 @@ public class ContentViewClient {
intent = Intent.parseUri(intentUrl, Intent.URI_INTENT_SCHEME);
String scheme = intent.getScheme();
- if (!scheme.equals(GEO_SCHEME) && !scheme.equals(TEL_SCHEME)
- && !scheme.equals(MAILTO_SCHEME)) {
+ if (!isAcceptableContentIntentScheme(scheme)) {
Log.w(TAG, "Invalid scheme for URI %s", intentUrl);
return;
}
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698