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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java

Issue 2429913002: [TTS] Promote clicks on AMP carousel to a separate Tab. (Closed)
Patch Set: Check the URI to see if it's really and AMP link. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java
index 3848c9dcfe3a3e05f61bd3e3b37916590d59058e..a953667f213211dd36978f0683d77e27632a417a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java
@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.contextualsearch;
import android.content.Context;
+import android.net.Uri;
import android.text.TextUtils;
import org.chromium.base.VisibleForTesting;
@@ -27,6 +28,8 @@ import javax.annotation.Nullable;
*/
class ContextualSearchPolicy {
private static final Pattern CONTAINS_WHITESPACE_PATTERN = Pattern.compile("\\s");
+ private static final String DOMAIN_GOOGLE = "google";
+ private static final String PATH_AMP = "/amp/";
private static final int REMAINING_NOT_APPLICABLE = -1;
private static final int ONE_DAY_IN_MILLIS = 24 * 60 * 60 * 1000;
private static final int TAP_TRIGGERED_PROMO_LIMIT = 50;
@@ -401,6 +404,14 @@ class ContextualSearchPolicy {
return ContextualSearchFieldTrial.isQuickAnswersEnabled();
}
+ /**
+ * @return Whether the given URL is used for Accelerated Mobile Pages by Google.
+ */
+ boolean isAmpUrl(String url) {
+ Uri uri = Uri.parse(url);
+ return uri.getHost().contains(DOMAIN_GOOGLE) && uri.getPath().startsWith(PATH_AMP);
+ }
+
// --------------------------------------------------------------------------------------------
// Testing support.
// --------------------------------------------------------------------------------------------
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698