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

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

Issue 2821533003: Refactor NotificationPlatformBridgeLinux (Closed)
Patch Set: add additional comments Created 3 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/native_notification_display_service.h
diff --git a/chrome/browser/notifications/native_notification_display_service.h b/chrome/browser/notifications/native_notification_display_service.h
index f5c8fee36b42b7e907a73a1b65de07536f2095b2..3e7248774bb938ed9bfbc3768141b68e57bf5984 100644
--- a/chrome/browser/notifications/native_notification_display_service.h
+++ b/chrome/browser/notifications/native_notification_display_service.h
@@ -7,10 +7,12 @@
#include <map>
#include <memory>
+#include <queue>
#include <set>
#include <string>
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/notification_display_service.h"
@@ -18,6 +20,7 @@ namespace base {
class NullableString16;
}
+class MessageCenterDisplayService;
class Notification;
class NotificationHandler;
class NotificationPlatformBridge;
@@ -60,11 +63,36 @@ class NativeNotificationDisplayService : public NotificationDisplayService {
NotificationHandler* GetNotificationHandler(
NotificationCommon::Type notification_type);
+ // Called by |notification_bridge_| when it is finished
+ // initializing. |success| indicates it is ready to be used.
+ void OnNotificationPlatformBridgeInitialized(bool success);
+
+ void DisplayNow(NotificationCommon::Type notification_type,
+ const std::string& notification_id,
+ const Notification& notification);
+ void CloseNow(NotificationCommon::Type notification_type,
+ const std::string& notification_id);
+ void GetDisplayedNow(const DisplayedNotificationsCallback& callback);
+
Profile* profile_;
+
NotificationPlatformBridge* notification_bridge_;
+ // Is |notification_bridge_| ready to be used?
+ bool notification_bridge_connected_;
+
+ // MessageCenterDisplayService to fallback on if initialization of
+ // |notification_bridge_| failed.
+ std::unique_ptr<MessageCenterDisplayService> message_center_display_service_;
+
+ // Tasks that need to be run once we have the initialization status
+ // for |notification_bridge_|.
+ std::queue<base::Callback<void(void)>> actions_;
Lei Zhang 2017/04/21 22:45:17 base::Callback<void(void)> -> base::Closure
Tom (Use chromium acct) 2017/04/24 20:46:14 Done.
+
std::map<NotificationCommon::Type, std::unique_ptr<NotificationHandler>>
notification_handlers_;
+ base::WeakPtrFactory<NativeNotificationDisplayService> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(NativeNotificationDisplayService);
};

Powered by Google App Engine
This is Rietveld 408576698