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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java

Issue 2769993002: Restrict getInstalledRelatedApps() to non-incognito contexts. (Closed)
Patch Set: fix variable name + todo Created 3 years, 9 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: content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java b/content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java
index fb4353128202f721f1abfc488d81e1e94a0df9c9..d07abed0a3f938dd176d1d87d8d89a9ea214e5ea 100644
--- a/content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java
+++ b/content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java
@@ -54,6 +54,11 @@ public class InstalledAppProviderImpl implements InstalledAppProvider {
* Gets the URL of the current frame. Can return null (if the frame has disappeared).
*/
public URI getUrl();
+
+ /**
+ * Checks if we're in incognito. If the frame has disappeared this returns true.
+ */
+ public boolean isIncognito();
}
public InstalledAppProviderImpl(FrameUrlDelegate frameUrlDelegate, Context context) {
@@ -64,6 +69,11 @@ public class InstalledAppProviderImpl implements InstalledAppProvider {
@Override
public void filterInstalledApps(
RelatedApplication[] relatedApps, FilterInstalledAppsResponse callback) {
+ if (mFrameUrlDelegate.isIncognito()) {
+ callback.call(new RelatedApplication[0]);
+ return;
+ }
+
URI frameUrl = mFrameUrlDelegate.getUrl();
ArrayList<RelatedApplication> installedApps = new ArrayList<RelatedApplication>();
PackageManager pm = mContext.getPackageManager();
@@ -79,6 +89,7 @@ public class InstalledAppProviderImpl implements InstalledAppProvider {
installedApps.add(app);
}
}
+
RelatedApplication[] installedAppsArray = new RelatedApplication[installedApps.size()];
installedApps.toArray(installedAppsArray);
callback.call(installedAppsArray);

Powered by Google App Engine
This is Rietveld 408576698