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

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

Issue 2841193002: Implement privacy disclosure for an unbound webapk. (Closed)
Patch Set: 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/webapps/WebApkActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java
index a6d3108cc311843903e59a0f2887723294d224d5..1ef9508a604eb1ba7436f6bf16b30ca5038dc85f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java
@@ -4,6 +4,8 @@
package org.chromium.chrome.browser.webapps;
+import static org.chromium.webapk.lib.common.WebApkConstants.WEBAPK_PACKAGE_PREFIX;
+
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
@@ -24,6 +26,7 @@ import org.chromium.webapk.lib.client.WebApkServiceConnectionManager;
import java.util.concurrent.TimeUnit;
dominickn 2017/05/24 01:24:36 Nit: extra newline
Yaron 2017/05/24 18:08:29 Done.
+
/**
* An Activity is designed for WebAPKs (native Android apps) and displays a webapp in a nearly
* UI-less Chrome.
@@ -41,6 +44,9 @@ public class WebApkActivity extends WebappActivity {
/** The start time that the activity becomes focused. */
private long mStartTime;
+ /** The id tag for the disclosure notification, if one is presented. */
+ private int mNotificationId = 0;
+
@Override
protected WebappInfo createWebappInfo(Intent intent) {
return (intent == null) ? WebApkInfo.createEmpty() : WebApkInfo.create(intent);
@@ -104,6 +110,9 @@ public class WebApkActivity extends WebappActivity {
@Override
public void onStopWithNative() {
super.onStopWithNative();
+ if (mNotificationId != 0) {
+ WebApkDisclosureNotificationManager.dismissNotification(mWebappInfo, mNotificationId);
+ }
if (mUpdateManager != null && mUpdateManager.requestPendingUpdate()) {
WebApkUma.recordUpdateRequestSent(WebApkUma.UPDATE_REQUEST_SENT_ONSTOP);
}
@@ -150,6 +159,15 @@ public class WebApkActivity extends WebappActivity {
mUpdateManager = new WebApkUpdateManager(WebApkActivity.this, storage);
mUpdateManager.updateIfNeeded(getActivityTab(), info);
+
+ // If we're showing a WebApk that's not with an expected package, it must be an
+ // "Unbound WebApk" (crbug.com/714735) so show a notification that it's backed by
+ // Chrome.
+ if (!getWebApkPackageName().startsWith(WEBAPK_PACKAGE_PREFIX)
+ && !storage.hasDismissedDisclosure()) {
+ mNotificationId = WebApkDisclosureNotificationManager.showDisclosure(
Yaron 2017/05/24 01:13:16 note, because I moved this out of onStartWithNativ
+ mWebappInfo, storage);
+ }
}
@Override

Powered by Google App Engine
This is Rietveld 408576698