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

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

Issue 2873843002: Support autopresenting WebVr content. (Closed)
Patch Set: rebase Created 3 years, 7 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
Index: chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
index d6e0e5303c3acda8786a8f74108e0cfa45a44167..31e60622eb19b56d0a0f81aeeb2797d2c3baad6f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
@@ -794,6 +794,21 @@ public class IntentHandler {
return false;
}
+ /**
+ * @param intent An Intent to be checked.
+ * @param packageName The app where the intent is expected to originate from
+ * @return Whether the intent originates from the first-party app with the given package name.
+ */
+ public static boolean isIntentFromTrustedApp(Intent intent, String packageName) {
+ if (intent == null) return false;
+
+ PendingIntent token = fetchAuthenticationTokenFromIntent(intent);
+ if (token == null) return false;
+
+ return isIntentChromeOrFirstParty(intent)
+ && ApiCompatibilityUtils.getCreatorPackage(token).equals(packageName);
+ }
+
@VisibleForTesting
boolean isIntentUserVisible() {
// Only process Intents if the screen is on and the device is unlocked;

Powered by Google App Engine
This is Rietveld 408576698