DO NOT MERGE - Update and fix RLZ code:
- Cache RLZ parameter
- Set RLZ parameter for address bar searches
- Add broadcast receiver to handle RLZ updates
- Update RLZ parameters in home page and bookmarks
Bug: 4436761
Change-Id: I505932656c68dca458283598c2f647e035f120d3
diff --git a/src/com/android/browser/UrlUtils.java b/src/com/android/browser/UrlUtils.java
index d6278ca..8c789db 100644
--- a/src/com/android/browser/UrlUtils.java
+++ b/src/com/android/browser/UrlUtils.java
@@ -159,4 +159,34 @@
return inUrl;
}
+ // Determine if this URI appears to be a Google property
+ /* package */ static boolean isGoogleUri(Uri uri) {
+ String scheme = uri.getScheme();
+ if (!"http".equals(scheme) && !"https".equals(scheme)) {
+ return false;
+ }
+
+ String host = uri.getHost();
+ if (host == null) {
+ return false;
+ }
+ String[] hostComponents = host.split("\\.");
+ if (hostComponents.length < 2) {
+ return false;
+ }
+
+ int googleComponent = hostComponents.length - 2;
+ String component = hostComponents[googleComponent];
+ if (!"google".equals(component)) {
+ if (hostComponents.length < 3 ||
+ (!"co".equals(component) && !"com".equals(component))) {
+ return false;
+ }
+ googleComponent = hostComponents.length - 3;
+ if (!"google".equals(hostComponents[googleComponent])) {
+ return false;
+ }
+ }
+ return true;
+ }
}