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

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

Issue 2636103002: [WebAPKs] Show minibar when WebAPK navigates outside scope specified in Web Manifest (Closed)
Patch Set: Merge branch 'master' into minibar Created 3 years, 11 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
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.util; 5 package org.chromium.chrome.browser.util;
6 6
7 import android.text.TextUtils; 7 import android.text.TextUtils;
8 8
9 import org.chromium.base.CollectionUtil; 9 import org.chromium.base.CollectionUtil;
10 import org.chromium.base.Log; 10 import org.chromium.base.Log;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 * no subdomains, from the given URI. Returns an empty string if the URI is invalid, has no host 143 * no subdomains, from the given URI. Returns an empty string if the URI is invalid, has no host
144 * (e.g. a file: URI), has multiple trailing dots, is an IP address, has onl y one subcomponent 144 * (e.g. a file: URI), has multiple trailing dots, is an IP address, has onl y one subcomponent
145 * (i.e. no dots other than leading/trailing ones), or is itself a recognize d registry 145 * (i.e. no dots other than leading/trailing ones), or is itself a recognize d registry
146 * identifier. 146 * identifier.
147 */ 147 */
148 public static String getDomainAndRegistry(String uri, boolean includePrivate Registries) { 148 public static String getDomainAndRegistry(String uri, boolean includePrivate Registries) {
149 if (TextUtils.isEmpty(uri)) return uri; 149 if (TextUtils.isEmpty(uri)) return uri;
150 return nativeGetDomainAndRegistry(uri, includePrivateRegistries); 150 return nativeGetDomainAndRegistry(uri, includePrivateRegistries);
151 } 151 }
152 152
153 /** Returns whether a URL is within another URL's scope. */
154 @VisibleForTesting
155 public static boolean isUrlWithinScope(String url, String scopeUrl) {
156 return nativeIsUrlWithinScope(url, scopeUrl);
157 }
158
153 /** @return whether two URLs match, ignoring the #fragment. */ 159 /** @return whether two URLs match, ignoring the #fragment. */
154 @VisibleForTesting 160 @VisibleForTesting
155 public static boolean urlsMatchIgnoringFragments(String url, String url2) { 161 public static boolean urlsMatchIgnoringFragments(String url, String url2) {
156 if (TextUtils.equals(url, url2)) return true; 162 if (TextUtils.equals(url, url2)) return true;
157 return nativeUrlsMatchIgnoringFragments(url, url2); 163 return nativeUrlsMatchIgnoringFragments(url, url2);
158 } 164 }
159 165
160 /** @return whether the #fragmant differs in two URLs. */ 166 /** @return whether the #fragmant differs in two URLs. */
161 @VisibleForTesting 167 @VisibleForTesting
162 public static boolean urlsFragmentsDiffer(String url, String url2) { 168 public static boolean urlsFragmentsDiffer(String url, String url2) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 private static native boolean nativeIsDownloadable(String url); 321 private static native boolean nativeIsDownloadable(String url);
316 private static native boolean nativeIsValidForIntentFallbackNavigation(Strin g url); 322 private static native boolean nativeIsValidForIntentFallbackNavigation(Strin g url);
317 private static native boolean nativeIsAcceptedScheme(String url); 323 private static native boolean nativeIsAcceptedScheme(String url);
318 private static native boolean nativeSameDomainOrHost(String primaryUrl, Stri ng secondaryUrl, 324 private static native boolean nativeSameDomainOrHost(String primaryUrl, Stri ng secondaryUrl,
319 boolean includePrivateRegistries); 325 boolean includePrivateRegistries);
320 private static native boolean nativeSameHost(String primaryUrl, String secon daryUrl); 326 private static native boolean nativeSameHost(String primaryUrl, String secon daryUrl);
321 private static native String nativeGetDomainAndRegistry(String url, 327 private static native String nativeGetDomainAndRegistry(String url,
322 boolean includePrivateRegistries); 328 boolean includePrivateRegistries);
323 public static native boolean nativeIsGoogleSearchUrl(String url); 329 public static native boolean nativeIsGoogleSearchUrl(String url);
324 public static native boolean nativeIsGoogleHomePageUrl(String url); 330 public static native boolean nativeIsGoogleHomePageUrl(String url);
331 private static native boolean nativeIsUrlWithinScope(String url, String scop eUrl);
325 private static native boolean nativeUrlsMatchIgnoringFragments(String url, S tring url2); 332 private static native boolean nativeUrlsMatchIgnoringFragments(String url, S tring url2);
326 private static native boolean nativeUrlsFragmentsDiffer(String url, String u rl2); 333 private static native boolean nativeUrlsFragmentsDiffer(String url, String u rl2);
327 } 334 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698