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

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

Issue 2828503005: Add NotificationDisplayServiceProxy (Closed)
Patch Set: 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/notification_display_service_proxy.h
diff --git a/chrome/browser/notifications/notification_display_service_proxy.h b/chrome/browser/notifications/notification_display_service_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..2e33830bc7afa7eb150e37ae5ada2d90679c3964
--- /dev/null
+++ b/chrome/browser/notifications/notification_display_service_proxy.h
@@ -0,0 +1,53 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_PROXY_H_
+#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_PROXY_H_
+
+#include <queue>
Peter Beverloo 2017/04/19 13:26:41 #include <memory> #include "base/callback.h" class
Tom (Use chromium acct) 2017/04/20 01:43:47 Done.
+
+#include "chrome/browser/notifications/notification_display_service.h"
+
+class MessageCenterDisplayService;
+class NativeNotificationDisplayService;
+
+class NotificationDisplayServiceProxy : public NotificationDisplayService {
+ public:
+ explicit NotificationDisplayServiceProxy(Profile* profile);
+
+ ~NotificationDisplayServiceProxy() override;
+
+ // NotificationDisplayService:
+ void Display(NotificationCommon::Type notification_type,
+ const std::string& notification_id,
+ const Notification& notification) override;
+ void Close(NotificationCommon::Type notification_type,
+ const std::string& notification_id) override;
+ void GetDisplayed(const DisplayedNotificationsCallback& callback) override;
+
+ NativeNotificationDisplayService* native_notification_display_service() {
+ return native_notification_display_service_.get();
+ }
+
+ private:
+ NotificationDisplayService* GetNotificationDisplayService() const;
+
+ void OnNotificationPlatformBridgeInitialized(bool success);
+
+ // Takes ownership of |action|.
+ void RunAction(base::Callback<void(NotificationDisplayService*)> action);
+
+ Profile* profile_;
+
+ std::queue<base::Callback<void(NotificationDisplayService*)>> actions_;
+
+ std::unique_ptr<NativeNotificationDisplayService>
+ native_notification_display_service_;
+
+ std::unique_ptr<MessageCenterDisplayService> message_center_display_service_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotificationDisplayServiceProxy);
+};
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_PROXY_H_

Powered by Google App Engine
This is Rietveld 408576698