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

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

Issue 1814923002: Nuke NotificationUIManager from PlatformNotificationServiceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@profile_manager_load
Patch Set: Rebase Created 4 years, 9 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_UI_MANAGER_MAC_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_MAC_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_MAC_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_MAC_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "chrome/browser/notifications/notification_ui_manager.h" 13 #include "chrome/browser/notifications/notification_display_service.h"
14 14
15 class Notification; 15 class Notification;
16 @class NotificationCenterDelegate; 16 @class NotificationCenterDelegate;
17 @class NSUserNotificationCenter;
17 class PrefService; 18 class PrefService;
18 class Profile; 19 class Profile;
19 20
20 // This class is an implementation of NotificationUIManager that will 21 // This class is an implementation of NotificationUIManager that will
21 // send platform notifications to the Notification Center on 10.8 and above. 22 // send platform notifications to the Notification Center on 10.8 and above.
22 // 10.7 and below don't offer native notification support so chrome 23 // 10.7 and below don't offer native notification support so chrome
23 // notifications are still used there. 24 // notifications are still used there.
24 class NotificationUIManagerMac : public NotificationUIManager { 25 class NotificationUIManagerMac : public NotificationDisplayService {
25 public: 26 public:
26 NotificationUIManagerMac(); 27 NotificationUIManagerMac(Profile* profile,
28 NSUserNotificationCenter* notification_center);
Peter Beverloo 2016/03/21 15:57:04 What about having a SetUserNotificationCenterForTe
Miguel Garcia 2016/03/21 17:43:03 The usual pattern for testing has usually been to
27 ~NotificationUIManagerMac() override; 29 ~NotificationUIManagerMac() override;
28 30
29 // NotificationUIManager implementation 31 // NotificationDisplayService implementation
30 void Add(const Notification& notification, Profile* profile) override; 32 void Display(const Notification& notification) override;
31 bool Update(const Notification& notification, Profile* profile) override;
32 33
33 // |delegate_id| need to reference a PersistentNotificationDelegate 34 bool Close(const std::string& persistent_notification_id) override;
34 const Notification* FindById(const std::string& delegate_id, 35 std::set<std::string> GetDisplayed() const override;
35 ProfileID profile_id) const override; 36 bool SupportsNotificationCenter() const override;
36
37 // |delegate_id| need to reference a PersistentNotificationDelegate
38 bool CancelById(const std::string& delegate_id,
39 ProfileID profile_id) override;
40 std::set<std::string> GetAllIdsByProfileAndSourceOrigin(
41 ProfileID profile_id,
42 const GURL& source) override;
43 std::set<std::string> GetAllIdsByProfile(ProfileID profile_id) override;
44 bool CancelAllBySourceOrigin(const GURL& source_origin) override;
45 bool CancelAllByProfile(ProfileID profile_id) override;
46 void CancelAll() override;
47 37
48 private: 38 private:
49 // Cocoa class that receives callbacks from the NSUserNotificationCenter. 39 // Cocoa class that receives callbacks from the NSUserNotificationCenter.
50 base::scoped_nsobject<NotificationCenterDelegate> delegate_; 40 base::scoped_nsobject<NotificationCenterDelegate> delegate_;
51 41
42 // The notification center to use, this can be overriden in tests
43 NSUserNotificationCenter* notification_center_;
44
52 DISALLOW_COPY_AND_ASSIGN(NotificationUIManagerMac); 45 DISALLOW_COPY_AND_ASSIGN(NotificationUIManagerMac);
53 }; 46 };
54 47
55 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_MAC_H_ 48 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698