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

Unified Diff: chrome/android/webapk/libs/runtime_library/src/org/chromium/webapk/lib/runtime_library/WebApkServiceImpl.java

Issue 1969303002: Upstream WebAPK notification related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/webapk/libs/runtime_library/src/org/chromium/webapk/lib/runtime_library/WebApkServiceImpl.java
diff --git a/chrome/android/webapk/libs/runtime_library/src/org/chromium/webapk/lib/runtime_library/WebApkServiceImpl.java b/chrome/android/webapk/libs/runtime_library/src/org/chromium/webapk/lib/runtime_library/WebApkServiceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..793b8aa0fbd2c8221ac3e331d861e6fd50343b4c
--- /dev/null
+++ b/chrome/android/webapk/libs/runtime_library/src/org/chromium/webapk/lib/runtime_library/WebApkServiceImpl.java
@@ -0,0 +1,53 @@
+// Copyright 2016 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.webapk.lib.runtime_library;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.content.Context;
+
+/**
+ * Implements services offered by the WebAPK to Chrome.
+ */
+public class WebApkServiceImpl extends IWebApkApi.Stub {
+
+ private static final String TAG = "WebApkServiceImpl";
+
+ private final Context mContext;
+
+ /**
+ * Id of icon to represent WebAPK notifications in status bar.
+ */
+ private final int mSmallIconId;
+
+ /**
+ * Creates an instance of WebApkServiceImpl.
+ * @param context
+ * @param smallIconId Id of icon to represent notifications in status bar.
+ */
+ public WebApkServiceImpl(Context context, int smallIconId) {
+ mContext = context;
+ mSmallIconId = smallIconId;
+ }
+
+ @Override
+ public int getSmallIconId() {
+ return mSmallIconId;
+ }
+
+ @Override
+ public void notifyNotification(String platformTag, int platformID, Notification notification) {
+ getNotificationManager().notify(platformTag, platformID, notification);
+ }
+
+ @Override
+ public void cancelNotification(String platformTag, int platformID) {
+ getNotificationManager().cancel(platformTag, platformID);
+ }
+
+ private NotificationManager getNotificationManager() {
+ return (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698