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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java

Issue 1814923002: Nuke NotificationUIManager from PlatformNotificationServiceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@profile_manager_load
Patch Set: Created 4 years, 8 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/browser/android/chrome_jni_registrar.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.chrome.browser.notifications; 5 package org.chromium.chrome.browser.notifications;
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.app.PendingIntent; 9 import android.app.PendingIntent;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 /** 89 /**
90 * Creates a new instance of the NotificationUIManager. 90 * Creates a new instance of the NotificationUIManager.
91 * 91 *
92 * @param nativeNotificationManager Instance of the NotificationUIManagerAnd roid class. 92 * @param nativeNotificationManager Instance of the NotificationUIManagerAnd roid class.
93 * @param context Application context for this instance of Chrome. 93 * @param context Application context for this instance of Chrome.
94 */ 94 */
95 @CalledByNative 95 @CalledByNative
96 private static NotificationUIManager create(long nativeNotificationManager, Context context) { 96 private static NotificationUIManager create(long nativeNotificationManager, Context context) {
97 if (sInstance != null) { 97 if (sInstance != null) {
98 throw new IllegalStateException("There must only be a single Notific ationUIManager."); 98 throw new IllegalStateException(
99 "There must only be a single NotificationPlatformBridge.");
99 } 100 }
100 101
101 sInstance = new NotificationUIManager(nativeNotificationManager, context ); 102 sInstance = new NotificationUIManager(nativeNotificationManager, context );
102 return sInstance; 103 return sInstance;
103 } 104 }
104 105
105 /** 106 /**
106 * Returns the current instance of the NotificationUIManager. 107 * Returns the current instance of the NotificationUIManager.
107 * 108 *
108 * @return The instance of the NotificationUIManager, if any. 109 * @return The instance of the NotificationUIManager, if any.
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 */ 634 */
634 public static boolean wasNotificationRecentlyClicked() { 635 public static boolean wasNotificationRecentlyClicked() {
635 if (sInstance == null) return false; 636 if (sInstance == null) return false;
636 long now = System.currentTimeMillis(); 637 long now = System.currentTimeMillis();
637 return now - sInstance.mLastNotificationClickMs < 5 * 1000; 638 return now - sInstance.mLastNotificationClickMs < 5 * 1000;
638 } 639 }
639 640
640 /** 641 /**
641 * Closes the notification associated with the given parameters. 642 * Closes the notification associated with the given parameters.
642 * 643 *
644 * @param profileId of the profile whose notification this is for.
643 * @param persistentNotificationId The persistent id of the notification. 645 * @param persistentNotificationId The persistent id of the notification.
644 * @param origin The origin to which the notification belongs. 646 * @param origin The origin to which the notification belongs.
645 * @param tag The tag of the notification. May be NULL. 647 * @param tag The tag of the notification. May be NULL.
646 */ 648 */
647 @CalledByNative 649 @CalledByNative
648 private void closeNotification(long persistentNotificationId, String origin, String tag) { 650 private void closeNotification(
651 String profileId, long persistentNotificationId, String origin, Stri ng tag) {
652 // TODO(miguelg) make profile_id part of the tag.
649 String platformTag = makePlatformTag(persistentNotificationId, origin, t ag); 653 String platformTag = makePlatformTag(persistentNotificationId, origin, t ag);
650 mNotificationManager.cancel(platformTag, PLATFORM_ID); 654 mNotificationManager.cancel(platformTag, PLATFORM_ID);
651 } 655 }
652 656
653 /** 657 /**
654 * Calls NotificationUIManagerAndroid::OnNotificationClicked in native code to indicate that 658 * Calls NotificationUIManagerAndroid::OnNotificationClicked in native code to indicate that
655 * the notification with the given parameters has been clicked on. 659 * the notification with the given parameters has been clicked on.
656 * 660 *
657 * @param persistentNotificationId The persistent id of the notification. 661 * @param persistentNotificationId The persistent id of the notification.
658 * @param origin The origin of the notification. 662 * @param origin The origin of the notification.
(...skipping 27 matching lines...) Expand all
686 690
687 private static native void nativeInitializeNotificationUIManager(); 691 private static native void nativeInitializeNotificationUIManager();
688 692
689 private native void nativeOnNotificationClicked(long nativeNotificationUIMan agerAndroid, 693 private native void nativeOnNotificationClicked(long nativeNotificationUIMan agerAndroid,
690 long persistentNotificationId, String origin, String profileId, bool ean incognito, 694 long persistentNotificationId, String origin, String profileId, bool ean incognito,
691 String tag, int actionIndex); 695 String tag, int actionIndex);
692 private native void nativeOnNotificationClosed(long nativeNotificationUIMana gerAndroid, 696 private native void nativeOnNotificationClosed(long nativeNotificationUIMana gerAndroid,
693 long persistentNotificationId, String origin, String profileId, bool ean incognito, 697 long persistentNotificationId, String origin, String profileId, bool ean incognito,
694 String tag, boolean byUser); 698 String tag, boolean byUser);
695 } 699 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/chrome_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698