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

Side by Side Diff: chrome/browser/notifications/non_persistent_notification_handler.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NON_PERSISTENT_NOTIFICATION_HANDLER_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NON_PERSISTENT_NOTIFICATION_HANDLER_H_
7
8 #include <unordered_map>
9
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/notifications/notification_handler.h"
13
14 class NotificationDelegate;
15
16 // NotificationHandler implementation for non persistent notifications.
17 class NonPersistentNotificationHandler : public NotificationHandler {
18 public:
19 NonPersistentNotificationHandler();
20 ~NonPersistentNotificationHandler() override;
21
22 // NotificationHandler implementation
23 void OnClose(Profile* profile,
24 const std::string& origin,
25 const std::string& notification_id,
26 bool by_user) override;
27
28 void OnClick(Profile* profile,
29 const std::string& origin,
30 const std::string& notification_id,
31 int action_index) override;
32
33 void OpenSettings(Profile* profile) override;
34
35 void RegisterNotification(const std::string& notification_id,
36 NotificationDelegate* delegate) override;
37
38 private:
39 // map of delegate objects keyed by notification id.
40 std::unordered_map<std::string, scoped_refptr<NotificationDelegate>>
41 notifications_;
42
43 DISALLOW_COPY_AND_ASSIGN(NonPersistentNotificationHandler);
44 };
45
46 #endif // CHROME_BROWSER_NOTIFICATIONS_NON_PERSISTENT_NOTIFICATION_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698