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

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

Issue 2916383004: Revert of Minimize the delegate dependencies for non persistent notifications. (Closed)
Patch Set: Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_NON_PERSISTENT_NOTIFICATION_HANDLER_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NON_PERSISTENT_NOTIFICATION_HANDLER_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NON_PERSISTENT_NOTIFICATION_HANDLER_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NON_PERSISTENT_NOTIFICATION_HANDLER_H_
7 7
8 #include <unordered_map>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
9 #include "chrome/browser/notifications/notification_handler.h" 12 #include "chrome/browser/notifications/notification_handler.h"
10 13
14 class NotificationDelegate;
15
11 // NotificationHandler implementation for non persistent notifications. 16 // NotificationHandler implementation for non persistent notifications.
12 class NonPersistentNotificationHandler : public NotificationHandler { 17 class NonPersistentNotificationHandler : public NotificationHandler {
13 public: 18 public:
14 NonPersistentNotificationHandler(); 19 NonPersistentNotificationHandler();
15 ~NonPersistentNotificationHandler() override; 20 ~NonPersistentNotificationHandler() override;
16 21
17 // NotificationHandler implementation 22 // NotificationHandler implementation
18 void OnClose(Profile* profile, 23 void OnClose(Profile* profile,
19 const std::string& origin, 24 const std::string& origin,
20 const std::string& notification_id, 25 const std::string& notification_id,
21 bool by_user) override; 26 bool by_user) override;
22 27
23 void OnClick(Profile* profile, 28 void OnClick(Profile* profile,
24 const std::string& origin, 29 const std::string& origin,
25 const std::string& notification_id, 30 const std::string& notification_id,
26 int action_index, 31 int action_index,
27 const base::NullableString16& reply) override; 32 const base::NullableString16& reply) override;
28 33
29 void OpenSettings(Profile* profile) override; 34 void OpenSettings(Profile* profile) override;
30 35
36 void RegisterNotification(const std::string& notification_id,
37 NotificationDelegate* delegate) override;
38
31 private: 39 private:
40 // map of delegate objects keyed by notification id.
41 std::unordered_map<std::string, scoped_refptr<NotificationDelegate>>
42 notifications_;
43
32 DISALLOW_COPY_AND_ASSIGN(NonPersistentNotificationHandler); 44 DISALLOW_COPY_AND_ASSIGN(NonPersistentNotificationHandler);
33 }; 45 };
34 46
35 #endif // CHROME_BROWSER_NOTIFICATIONS_NON_PERSISTENT_NOTIFICATION_HANDLER_H_ 47 #endif // CHROME_BROWSER_NOTIFICATIONS_NON_PERSISTENT_NOTIFICATION_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698