OLD | NEW |
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.CollectionUtil; | 9 import org.chromium.base.CollectionUtil; |
10 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 * @return The registered, organization-identifying host and all its registr
y information, but | 190 * @return The registered, organization-identifying host and all its registr
y information, but |
191 * no subdomains, from the given URI. Returns an empty string if the URI is
invalid, has no host | 191 * no subdomains, from the given URI. Returns an empty string if the URI is
invalid, has no host |
192 * (e.g. a file: URI), has multiple trailing dots, is an IP address, has onl
y one subcomponent | 192 * (e.g. a file: URI), has multiple trailing dots, is an IP address, has onl
y one subcomponent |
193 * (i.e. no dots other than leading/trailing ones), or is itself a recognize
d registry | 193 * (i.e. no dots other than leading/trailing ones), or is itself a recognize
d registry |
194 * identifier. | 194 * identifier. |
195 */ | 195 */ |
196 public static String getDomainAndRegistry(String uri, boolean includePrivate
Registries) { | 196 public static String getDomainAndRegistry(String uri, boolean includePrivate
Registries) { |
197 return nativeGetDomainAndRegistry(uri, includePrivateRegistries); | 197 return nativeGetDomainAndRegistry(uri, includePrivateRegistries); |
198 } | 198 } |
199 | 199 |
| 200 /** |
| 201 * @param url A URL. |
| 202 * @return Whether a given URL is one of [...]google.TLD or [...]youtube.TLD
URLs. |
| 203 */ |
| 204 public static boolean isGooglePropertyUrl(String url) { |
| 205 if (TextUtils.isEmpty(url)) return false; |
| 206 return nativeIsGooglePropertyUrl(url); |
| 207 } |
| 208 |
200 private static native boolean nativeSameDomainOrHost(String primaryUrl, Stri
ng secondaryUrl, | 209 private static native boolean nativeSameDomainOrHost(String primaryUrl, Stri
ng secondaryUrl, |
201 boolean includePrivateRegistries); | 210 boolean includePrivateRegistries); |
202 private static native String nativeGetDomainAndRegistry(String url, | 211 private static native String nativeGetDomainAndRegistry(String url, |
203 boolean includePrivateRegistries); | 212 boolean includePrivateRegistries); |
204 public static native boolean nativeIsGoogleSearchUrl(String url); | 213 public static native boolean nativeIsGoogleSearchUrl(String url); |
205 public static native boolean nativeIsGoogleHomePageUrl(String url); | 214 public static native boolean nativeIsGoogleHomePageUrl(String url); |
206 public static native String nativeFixupUrl(String url, String desiredTld); | 215 public static native String nativeFixupUrl(String url, String desiredTld); |
| 216 private static native boolean nativeIsGooglePropertyUrl(String url); |
207 } | 217 } |
OLD | NEW |