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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.app.KeyguardManager; 7 import android.app.KeyguardManager;
8 import android.app.PendingIntent; 8 import android.app.PendingIntent;
9 import android.app.SearchManager; 9 import android.app.SearchManager;
10 import android.content.ComponentName; 10 import android.content.ComponentName;
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 if (isChromeToken(token)) { 787 if (isChromeToken(token)) {
788 return true; 788 return true;
789 } 789 }
790 if (ExternalAuthUtils.getInstance().isGoogleSigned( 790 if (ExternalAuthUtils.getInstance().isGoogleSigned(
791 ApiCompatibilityUtils.getCreatorPackage(token))) { 791 ApiCompatibilityUtils.getCreatorPackage(token))) {
792 return true; 792 return true;
793 } 793 }
794 return false; 794 return false;
795 } 795 }
796 796
797 /**
798 * @param intent An Intent to be checked.
799 * @param packageName The app where the intent is expected to originate from
800 * @return Whether the intent originates from the first-party app with the g iven package name.
801 */
802 public static boolean isIntentFromTrustedApp(Intent intent, String packageNa me) {
803 if (intent == null) return false;
804
805 PendingIntent token = fetchAuthenticationTokenFromIntent(intent);
806 if (token == null) return false;
807
808 return isIntentChromeOrFirstParty(intent)
809 && ApiCompatibilityUtils.getCreatorPackage(token).equals(package Name);
810 }
811
797 @VisibleForTesting 812 @VisibleForTesting
798 boolean isIntentUserVisible() { 813 boolean isIntentUserVisible() {
799 // Only process Intents if the screen is on and the device is unlocked; 814 // Only process Intents if the screen is on and the device is unlocked;
800 // i.e. the user will see what is going on. 815 // i.e. the user will see what is going on.
801 Context appContext = ContextUtils.getApplicationContext(); 816 Context appContext = ContextUtils.getApplicationContext();
802 if (!ApiCompatibilityUtils.isInteractive(appContext)) return false; 817 if (!ApiCompatibilityUtils.isInteractive(appContext)) return false;
803 if (!ApiCompatibilityUtils.isDeviceProvisioned(appContext)) return true; 818 if (!ApiCompatibilityUtils.isDeviceProvisioned(appContext)) return true;
804 return !((KeyguardManager) appContext.getSystemService(Context.KEYGUARD_ SERVICE)) 819 return !((KeyguardManager) appContext.getSystemService(Context.KEYGUARD_ SERVICE))
805 .inKeyguardRestrictedInputMode(); 820 .inKeyguardRestrictedInputMode();
806 } 821 }
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 } 1041 }
1027 1042
1028 /** 1043 /**
1029 * @param intent An Intent to be checked. 1044 * @param intent An Intent to be checked.
1030 * @return The launch type of the tab to be created. 1045 * @return The launch type of the tab to be created.
1031 */ 1046 */
1032 public static TabLaunchType getTabLaunchType(Intent intent) { 1047 public static TabLaunchType getTabLaunchType(Intent intent) {
1033 return IntentUtils.safeGetSerializableExtra(intent, EXTRA_TAB_LAUNCH_TYP E); 1048 return IntentUtils.safeGetSerializableExtra(intent, EXTRA_TAB_LAUNCH_TYP E);
1034 } 1049 }
1035 } 1050 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698