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

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

Issue 2014303002: Upstream: Pass Bundle to WebApkServiceImpl constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/WebApkServiceFactory.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.webapk.lib.runtime_library; 5 package org.chromium.webapk.lib.runtime_library;
6 6
7 import android.app.Notification; 7 import android.app.Notification;
8 import android.app.NotificationManager; 8 import android.app.NotificationManager;
9 import android.content.Context; 9 import android.content.Context;
10 import android.os.Bundle;
10 11
11 /** 12 /**
12 * Implements services offered by the WebAPK to Chrome. 13 * Implements services offered by the WebAPK to Chrome.
13 */ 14 */
14 public class WebApkServiceImpl extends IWebApkApi.Stub { 15 public class WebApkServiceImpl extends IWebApkApi.Stub {
15 16
17 public static final String KEY_SMALL_ICON_ID = "small_icon_id";
18
16 private static final String TAG = "WebApkServiceImpl"; 19 private static final String TAG = "WebApkServiceImpl";
17 20
18 private final Context mContext; 21 private final Context mContext;
19 22
20 /** 23 /**
21 * Id of icon to represent WebAPK notifications in status bar. 24 * Id of icon to represent WebAPK notifications in status bar.
22 */ 25 */
23 private final int mSmallIconId; 26 private final int mSmallIconId;
24 27
25 /** 28 /**
26 * Creates an instance of WebApkServiceImpl. 29 * Creates an instance of WebApkServiceImpl.
27 * @param context 30 * @param context
28 * @param smallIconId Id of icon to represent notifications in status bar. 31 * @param bundle Bundle with additional constructor parameters.
29 */ 32 */
30 public WebApkServiceImpl(Context context, int smallIconId) { 33 public WebApkServiceImpl(Context context, Bundle bundle) {
31 mContext = context; 34 mContext = context;
32 mSmallIconId = smallIconId; 35 mSmallIconId = bundle.getInt(KEY_SMALL_ICON_ID);
33 } 36 }
34 37
35 @Override 38 @Override
36 public int getSmallIconId() { 39 public int getSmallIconId() {
37 return mSmallIconId; 40 return mSmallIconId;
38 } 41 }
39 42
40 @Override 43 @Override
41 public void notifyNotification(String platformTag, int platformID, Notificat ion notification) { 44 public void notifyNotification(String platformTag, int platformID, Notificat ion notification) {
42 getNotificationManager().notify(platformTag, platformID, notification); 45 getNotificationManager().notify(platformTag, platformID, notification);
43 } 46 }
44 47
45 @Override 48 @Override
46 public void cancelNotification(String platformTag, int platformID) { 49 public void cancelNotification(String platformTag, int platformID) {
47 getNotificationManager().cancel(platformTag, platformID); 50 getNotificationManager().cancel(platformTag, platformID);
48 } 51 }
49 52
50 private NotificationManager getNotificationManager() { 53 private NotificationManager getNotificationManager() {
51 return (NotificationManager) mContext.getSystemService(Context.NOTIFICAT ION_SERVICE); 54 return (NotificationManager) mContext.getSystemService(Context.NOTIFICAT ION_SERVICE);
52 } 55 }
53 } 56 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/WebApkServiceFactory.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698