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

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

Issue 2841193002: Implement privacy disclosure for an unbound webapk. (Closed)
Patch Set: nit 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/WebApkDisclosureNotificationService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkDisclosureNotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkDisclosureNotificationService.java
new file mode 100644
index 0000000000000000000000000000000000000000..e943301e1a022c2790a46ded164962f827741d73
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkDisclosureNotificationService.java
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.webapps;
+
+import android.app.IntentService;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+
+/**
+ * Service that handles the action of clicking on the WebApk disclosure notification.
+ */
+public class WebApkDisclosureNotificationService extends IntentService {
+ private static final String TAG = "WebApkDisclosureNotificationService";
+
+ private static final String ACTION_HIDE_DISCLOSURE =
+ "org.chromium.chrome.browser.webapps.HIDE_DISCLOSURE";
+
+ private static final String EXTRA_WEBAPP_ID = "webapp_id";
+
+ static PendingIntent getDeleteIntent(Context context, String webApkPackageName) {
+ Intent intent = new Intent(context, WebApkDisclosureNotificationService.class);
+ intent.setAction(ACTION_HIDE_DISCLOSURE);
+ intent.putExtra(EXTRA_WEBAPP_ID, webApkPackageName);
+ return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+ }
+
+ /** Empty public constructor needed by Android. */
+ public WebApkDisclosureNotificationService() {
+ super(TAG);
+ }
+
+ @Override
+ protected void onHandleIntent(Intent intent) {
+ String webappId = intent.getStringExtra(EXTRA_WEBAPP_ID);
+ WebappDataStorage storage = WebappRegistry.getInstance().getWebappDataStorage(webappId);
+ if (storage != null) storage.setDismissedDisclosure();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698