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

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

Issue 615433002: Add a resource throttle for sub frame unless scheme of uri is acceptable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/url_utilities.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.text.TextUtils; 7 import android.text.TextUtils;
8 8
9 import org.chromium.base.CalledByNative;
9 import org.chromium.base.CollectionUtil; 10 import org.chromium.base.CollectionUtil;
10 11
11 import java.net.URI; 12 import java.net.URI;
12 import java.net.URISyntaxException; 13 import java.net.URISyntaxException;
13 import java.util.HashSet; 14 import java.util.HashSet;
14 15
15 /** 16 /**
16 * Utilities for working with URIs (and URLs). These methods may be used in secu rity-sensitive 17 * Utilities for working with URIs (and URLs). These methods may be used in secu rity-sensitive
17 * contexts (after all, origins are the security boundary on the web), and so th e correctness bar 18 * contexts (after all, origins are the security boundary on the web), and so th e correctness bar
18 * must be high. 19 * must be high.
(...skipping 18 matching lines...) Expand all
37 */ 38 */
38 public static boolean isAcceptedScheme(URI uri) { 39 public static boolean isAcceptedScheme(URI uri) {
39 return ACCEPTED_SCHEMES.contains(uri.getScheme()); 40 return ACCEPTED_SCHEMES.contains(uri.getScheme());
40 } 41 }
41 42
42 /** 43 /**
43 * @param uri A URI. 44 * @param uri A URI.
44 * 45 *
45 * @return True if the URI's scheme is one that ContentView can handle. 46 * @return True if the URI's scheme is one that ContentView can handle.
46 */ 47 */
48 @CalledByNative
47 public static boolean isAcceptedScheme(String uri) { 49 public static boolean isAcceptedScheme(String uri) {
48 try { 50 try {
49 return isAcceptedScheme(new URI(uri)); 51 return isAcceptedScheme(new URI(uri));
50 } catch (URISyntaxException e) { 52 } catch (URISyntaxException e) {
51 return false; 53 return false;
52 } 54 }
53 } 55 }
54 56
55 /** 57 /**
56 * @param uri A URI. 58 * @param uri A URI.
57 * 59 *
58 * @return True if the URI's scheme is one that Chrome can download. 60 * @return True if the URI's scheme is one that Chrome can download.
59 */ 61 */
60 public static boolean isDownloadableScheme(URI uri) { 62 public static boolean isDownloadableScheme(URI uri) {
61 return DOWNLOADABLE_SCHEMES.contains(uri.getScheme()); 63 return DOWNLOADABLE_SCHEMES.contains(uri.getScheme());
62 } 64 }
63 65
64 /** 66 /**
65 * @param uri A URI. 67 * @param uri A URI.
66 * 68 *
67 * @return True if the URI's scheme is one that Chrome can download. 69 * @return True if the URI's scheme is one that Chrome can download.
68 */ 70 */
71 @CalledByNative
69 public static boolean isDownloadableScheme(String uri) { 72 public static boolean isDownloadableScheme(String uri) {
70 try { 73 try {
71 return isDownloadableScheme(new URI(uri)); 74 return isDownloadableScheme(new URI(uri));
72 } catch (URISyntaxException e) { 75 } catch (URISyntaxException e) {
73 return false; 76 return false;
74 } 77 }
75 } 78 }
76 79
77 /** 80 /**
78 * @param uri A URI to repair. 81 * @param uri A URI to repair.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 211
209 private static native boolean nativeSameDomainOrHost(String primaryUrl, Stri ng secondaryUrl, 212 private static native boolean nativeSameDomainOrHost(String primaryUrl, Stri ng secondaryUrl,
210 boolean includePrivateRegistries); 213 boolean includePrivateRegistries);
211 private static native String nativeGetDomainAndRegistry(String url, 214 private static native String nativeGetDomainAndRegistry(String url,
212 boolean includePrivateRegistries); 215 boolean includePrivateRegistries);
213 public static native boolean nativeIsGoogleSearchUrl(String url); 216 public static native boolean nativeIsGoogleSearchUrl(String url);
214 public static native boolean nativeIsGoogleHomePageUrl(String url); 217 public static native boolean nativeIsGoogleHomePageUrl(String url);
215 public static native String nativeFixupUrl(String url, String desiredTld); 218 public static native String nativeFixupUrl(String url, String desiredTld);
216 private static native boolean nativeIsGooglePropertyUrl(String url); 219 private static native boolean nativeIsGooglePropertyUrl(String url);
217 } 220 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/url_utilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698