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

Unified Diff: chrome/browser/notifications/notification_ui_manager_android.h

Issue 1814923002: Nuke NotificationUIManager from PlatformNotificationServiceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@profile_manager_load
Patch Set: Review comments + unique_ptr rename 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/notification_ui_manager_android.h
diff --git a/chrome/browser/notifications/notification_ui_manager_android.h b/chrome/browser/notifications/notification_ui_manager_android.h
index 3c210e83e0ad7012b38c2eaa9a939600a4c31276..c98022ceea798ca0985c2ccbd7493d76bdd67fa9 100644
--- a/chrome/browser/notifications/notification_ui_manager_android.h
+++ b/chrome/browser/notifications/notification_ui_manager_android.h
@@ -8,25 +8,26 @@
#include <jni.h>
#include <stdint.h>
#include <map>
+#include <set>
#include <string>
#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
-#include "chrome/browser/notifications/notification_ui_manager.h"
+#include "chrome/browser/notifications/notification_bridge.h"
-// Implementation of the Notification UI Manager for Android, which defers to
+// Implementation of the NotificationBridge for Android, which defers to
// the Android framework for displaying notifications.
//
-// Android does not support getting the notifications currently shown by an
-// app without very intrusive permissions, which means that it's not possible
-// to provide reliable implementations for methods which have to iterate over
-// the existing notifications. Because of this, these have not been implemented.
+// Prior to Android Marshmellow, Android did not have the ability to retrieve
+// the notifications currently showing for an app without a rather intrusive
+// permission. The GetDisplayed() method may return false because of this.
//
-// The UI manager implementation *is* reliable for adding and canceling single
-// notifications based on their delegate id. Finally, events for persistent Web
-// Notifications will be forwarded directly to the associated event handlers,
-// as such notifications may outlive the browser process on Android.
-class NotificationUIManagerAndroid : public NotificationUIManager {
+// The Android implementation *is* reliable for adding and canceling
+// single notifications based on their delegate id. Finally, events for
+// persistent Web Notifications will be forwarded directly to the associated
+// event handlers, as such notifications may outlive the browser process on
+// Android.
+class NotificationUIManagerAndroid : public NotificationBridge {
public:
NotificationUIManagerAndroid();
~NotificationUIManagerAndroid() override;
@@ -53,23 +54,19 @@ class NotificationUIManagerAndroid : public NotificationUIManager {
const base::android::JavaParamRef<jstring>& java_tag,
jboolean by_user);
- // NotificationUIManager implementation.
- void Add(const Notification& notification, Profile* profile) override;
- bool Update(const Notification& notification,
- Profile* profile) override;
- const Notification* FindById(const std::string& delegate_id,
- ProfileID profile_id) const override;
- bool CancelById(const std::string& delegate_id,
- ProfileID profile_id) override;
- std::set<std::string> GetAllIdsByProfileAndSourceOrigin(
- ProfileID profile_id,
- const GURL& source) override;
- std::set<std::string> GetAllIdsByProfile(ProfileID profile_id) override;
- bool CancelAllBySourceOrigin(const GURL& source_origin) override;
- bool CancelAllByProfile(ProfileID profile_id) override;
- void CancelAll() override;
+ // NotificationBridge implementation.
+ void Display(const std::string& notification_id,
+ const std::string& profile_id,
+ bool incognito,
+ const Notification& notification) override;
+ void Close(const std::string& profile_id,
+ const std::string& notification_id) override;
+ bool GetDisplayed(const std::string& profile_id,
+ bool incognito,
+ std::set<std::string>* notifications) const override;
+ bool SupportsNotificationCenter() const override;
- static bool RegisterNotificationUIManager(JNIEnv* env);
+ static bool RegisterNotificationBridge(JNIEnv* env);
private:
// Pair containing the information necessary in order to enable closing

Powered by Google App Engine
This is Rietveld 408576698