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

Side by Side Diff: chrome/browser/notifications/notification_platform_bridge_mac.h

Issue 2093953002: Introduce a new API to handle native notification clicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_MAC_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_MAC_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_MAC_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_MAC_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/mac/scoped_nsobject.h" 12 #include "base/mac/scoped_nsobject.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/browser/notifications/notification_common.h"
14 #include "chrome/browser/notifications/notification_platform_bridge.h" 15 #include "chrome/browser/notifications/notification_platform_bridge.h"
15 16
16 class Notification; 17 class Notification;
17 @class NotificationCenterDelegate; 18 @class NotificationCenterDelegate;
19 @class NSDictionary;
18 @class NSUserNotificationCenter; 20 @class NSUserNotificationCenter;
19 class PrefService; 21 class PrefService;
20 22
21 // This class is an implementation of NotificationPlatformBridge that will 23 // This class is an implementation of NotificationPlatformBridge that will
22 // send platform notifications to the the MacOSX notification center. 24 // send platform notifications to the the MacOSX notification center.
23 class NotificationPlatformBridgeMac : public NotificationPlatformBridge { 25 class NotificationPlatformBridgeMac : public NotificationPlatformBridge {
24 public: 26 public:
25 explicit NotificationPlatformBridgeMac( 27 explicit NotificationPlatformBridgeMac(
26 NSUserNotificationCenter* notification_center); 28 NSUserNotificationCenter* notification_center);
27 ~NotificationPlatformBridgeMac() override; 29 ~NotificationPlatformBridgeMac() override;
28 30
29 // NotificationPlatformBridge implementation. 31 // NotificationPlatformBridge implementation.
30 void Display(const std::string& notification_id, 32 void Display(NotificationCommon::Type notification_type,
33 const std::string& notification_id,
31 const std::string& profile_id, 34 const std::string& profile_id,
32 bool incognito, 35 bool incognito,
33 const Notification& notification) override; 36 const Notification& notification) override;
34 void Close(const std::string& profile_id, 37 void Close(const std::string& profile_id,
35 const std::string& notification_id) override; 38 const std::string& notification_id) override;
36 bool GetDisplayed(const std::string& profile_id, 39 bool GetDisplayed(const std::string& profile_id,
37 bool incognito, 40 bool incognito,
38 std::set<std::string>* notifications) const override; 41 std::set<std::string>* notifications) const override;
39 bool SupportsNotificationCenter() const override; 42 bool SupportsNotificationCenter() const override;
40 43
41 // Validates contents of the |response| dictionary as received from the system 44 // Validates contents of the |response| dictionary as received from the system
42 // when a notification gets activated. 45 // when a notification gets activated.
43 static bool VerifyNotificationData(NSDictionary* response) WARN_UNUSED_RESULT; 46 static bool VerifyNotificationData(NSDictionary* response) WARN_UNUSED_RESULT;
44 47
45 private: 48 private:
46 // Cocoa class that receives callbacks from the NSUserNotificationCenter. 49 // Cocoa class that receives callbacks from the NSUserNotificationCenter.
47 base::scoped_nsobject<NotificationCenterDelegate> delegate_; 50 base::scoped_nsobject<NotificationCenterDelegate> delegate_;
48 51
49 // The notification center to use, this can be overriden in tests 52 // The notification center to use, this can be overriden in tests
50 NSUserNotificationCenter* notification_center_; 53 NSUserNotificationCenter* notification_center_;
51 54
52 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeMac); 55 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeMac);
53 }; 56 };
54 57
55 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_MAC_H_ 58 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698