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

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

Issue 2749453002: Make GetDisplayedNotifications asynchronous. (Closed)
Patch Set: review Created 3 years, 9 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_display_service.h
diff --git a/chrome/browser/notifications/notification_display_service.h b/chrome/browser/notifications/notification_display_service.h
index 003274a60c48c6039f9c85e73ecacb2a94440c4f..1eeada650f22bb32015db13500370a95d5508fca 100644
--- a/chrome/browser/notifications/notification_display_service.h
+++ b/chrome/browser/notifications/notification_display_service.h
@@ -5,9 +5,11 @@
#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_H_
#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_H_
+#include <memory>
#include <set>
#include <string>
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "chrome/browser/notifications/notification_common.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -21,9 +23,11 @@ class Profile;
// instance can be retrieved through the NotificationDisplayServiceFactory.
//
// TODO(peter): Add a NotificationHandler mechanism for registering listeners.
-// TODO(miguelg): Remove the SupportsNotificationCenter method.
class NotificationDisplayService : public KeyedService {
public:
+ using DisplayedNotificationsCallback =
+ base::Callback<void(std::unique_ptr<std::set<std::string>>,
+ bool /* supports_synchronization */)>;
NotificationDisplayService() {}
~NotificationDisplayService() override {}
@@ -36,9 +40,10 @@ class NotificationDisplayService : public KeyedService {
virtual void Close(NotificationCommon::Type notification_type,
const std::string& notification_id) = 0;
- // Returns whether the implementation can retrieve a list of currently visible
- // notifications and stores them in |*notification_ids| when possible.
- virtual bool GetDisplayed(std::set<std::string>* notifications) const = 0;
+ // Writes the ids of all currently displaying notifications and
+ // invokes |callback| with the result once known.
+ virtual void GetDisplayed(
+ const DisplayedNotificationsCallback& callback) const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(NotificationDisplayService);

Powered by Google App Engine
This is Rietveld 408576698