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

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

Issue 2749453002: Make GetDisplayedNotifications asynchronous. (Closed)
Patch Set: revert early bailout if there is no service 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..c5cac2fd9790e40a5319cb58b872a6a9748f5089 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 posts
+ // |callback| with the result.
Peter Beverloo 2017/03/17 15:46:04 nit: generally we clarify *where* we post a callba
Miguel Garcia 2017/03/20 14:11:21 Done.
+ virtual void GetDisplayed(
+ const DisplayedNotificationsCallback& callback) const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(NotificationDisplayService);

Powered by Google App Engine
This is Rietveld 408576698