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

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

Issue 1509923002: Implement native web notifications for mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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_ui_manager_mac.h
diff --git a/chrome/browser/notifications/notification_ui_manager_mac.h b/chrome/browser/notifications/notification_ui_manager_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..755fd7898dd3fe0200a7cef0cdf6ddd25a347449
--- /dev/null
+++ b/chrome/browser/notifications/notification_ui_manager_mac.h
@@ -0,0 +1,51 @@
+// Copyright 2015 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_UI_MANAGER_MAC_H_
+#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_MAC_H_
+
+#include <map>
+#include <set>
+#include <string>
+
+#include "base/mac/scoped_nsobject.h"
+#include "base/mac/sdk_forward_declarations.h"
+#include "chrome/browser/notifications/notification_ui_manager.h"
+
+class Notification;
+@class NotificationCenterDelegate;
+class PrefService;
+class Profile;
+
+// This class is an implementation of NotificationUIManager that will
+// send platform notifications to the Notification Center on 10.8 and above.
Peter Beverloo 2015/12/09 00:12:00 This would be an excellent place to document *why*
Miguel Garcia 2015/12/10 20:16:30 Done.
+class NotificationUIManagerMac : public NotificationUIManager {
+ public:
+ NotificationUIManagerMac();
+ ~NotificationUIManagerMac() override;
+
+ // NotificationUIManager implementation
+ void Add(const Notification& notification, Profile* profile) override;
+ bool Update(const Notification& notification, Profile* profile) override;
+ const Notification* FindById(const std::string& delegate_id,
+ ProfileID profile_id) const override;
+ bool CancelById(const std::string& delegate_id,
+ ProfileID profile_id) override;
+ std::set<std::string> GetAllIdsByProfileAndSourceOrigin(
+ ProfileID profile_id,
+ const GURL& source) override;
+ std::set<std::string> GetAllIdsByProfile(ProfileID profile_id) override;
+ bool CancelAllBySourceOrigin(const GURL& source_origin) override;
+ bool CancelAllByProfile(ProfileID profile_id) override;
+ void CancelAll() override;
+ bool AcceptNativeNotifications() override;
+
+ private:
+ // Cocoa class that receives callbacks from the NSUserNotificationCenter.
+ base::scoped_nsobject<NotificationCenterDelegate> delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotificationUIManagerMac);
+};
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698