Chromium Code Reviews| 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..fe71a1215082185ed9bfbaf5744b2cfa11e1030e |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkDisclosureNotificationService.java |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
|
dominickn
2017/05/24 01:24:36
Nit: 2017
|
| +// 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 incognito 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 packageName) { |
|
awdf
2017/05/24 14:47:42
I'm not sure it's okay to start a service directly
Yaron
2017/05/24 14:59:25
I was mirroring what was done for the IncognitoNot
|
| + Intent intent = new Intent(context, WebApkDisclosureNotificationService.class); |
| + intent.setAction(ACTION_HIDE_DISCLOSURE); |
| + intent.putExtra(EXTRA_WEBAPP_ID, packageName); |
| + 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(); |
| + } |
| +} |