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

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

Issue 2821533003: Refactor NotificationPlatformBridgeLinux (Closed)
Patch Set: final 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..b02bac986c490cf01947d7266e96a70f3ca2bec9 100644
--- a/chrome/browser/notifications/native_notification_display_service.h
+++ b/chrome/browser/notifications/native_notification_display_service.h
@@ -7,10 +7,13 @@
#include <map>
#include <memory>
+#include <queue>
#include <set>
#include <string>
+#include "base/callback.h"
#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 +21,7 @@ namespace base {
class NullableString16;
}
+class MessageCenterDisplayService;
class Notification;
class NotificationHandler;
class NotificationPlatformBridge;
@@ -60,11 +64,29 @@ 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 OnNotificationPlatformBridgeReady(bool success);
+
Profile* profile_;
+
NotificationPlatformBridge* notification_bridge_;
+ // Indicates if |notification_bridge_| is ready to be used.
+ bool notification_bridge_ready_;
+
+ // 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::OnceClosure> actions_;
+
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