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

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

Issue 2749453002: Make GetDisplayedNotifications asynchronous. (Closed)
Patch Set: - 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_platform_bridge.h
diff --git a/chrome/browser/notifications/notification_platform_bridge.h b/chrome/browser/notifications/notification_platform_bridge.h
index 720245c8c8eb12465b5ab9d6d5ed949b4daa636f..cd36bdddaf9520e1d696088be9c963e76a23af04 100644
--- a/chrome/browser/notifications/notification_platform_bridge.h
+++ b/chrome/browser/notifications/notification_platform_bridge.h
@@ -8,6 +8,7 @@
#include <set>
#include <string>
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "chrome/browser/notifications/notification_common.h"
@@ -19,6 +20,9 @@ class Notification;
// TODO(miguelg): Add support for click and close events.
class NotificationPlatformBridge {
public:
+ using NotificationResultCallback =
Peter Beverloo 2017/03/15 18:07:50 nit: here and elsewhere: what is the "result" of a
Miguel Garcia 2017/03/16 14:57:42 Done.
+ base::Callback<void(std::unique_ptr<std::set<std::string>>,
+ bool /* supports synchronization */)>;
Peter Beverloo 2017/03/15 18:07:50 nit: blank line under this
Miguel Garcia 2017/03/16 14:57:42 Done.
static NotificationPlatformBridge* Create();
virtual ~NotificationPlatformBridge() {}
@@ -35,14 +39,12 @@ class NotificationPlatformBridge {
virtual void Close(const std::string& profile_id,
const std::string& notification_id) = 0;
- // Fills in |notifications| with a set of notification ids currently being
- // displayed for a given profile.
- // The return value expresses whether the underlying platform has the
- // capability to provide displayed notifications so the empty set
- // can be disambiguated.
- virtual bool GetDisplayed(const std::string& profile_id,
- bool incognito,
- std::set<std::string>* notification_ids) const = 0;
+ // Writes the ids of all currently displaying notifications and posts
+ // |callback| with the result.
+ virtual void GetDisplayed(
+ const std::string& profile_id,
+ bool incognito,
+ const NotificationResultCallback& callback) const = 0;
protected:
NotificationPlatformBridge() {}

Powered by Google App Engine
This is Rietveld 408576698