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

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

Issue 2418153002: Hooking up Android N inline notification replies end-to-end (Closed)
Patch Set: Reformat getNotificationReply Created 4 years, 2 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_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/browser/notifications/notification_common.h" 14 #include "chrome/browser/notifications/notification_common.h"
15 #include "chrome/browser/notifications/notification_display_service.h" 15 #include "chrome/browser/notifications/notification_display_service.h"
16 16
17 namespace base {
18 class NullableString16;
19 }
20
17 class Notification; 21 class Notification;
18 class NotificationHandler; 22 class NotificationHandler;
19 class NotificationPlatformBridge; 23 class NotificationPlatformBridge;
20 class Profile; 24 class Profile;
21 25
22 // A class to display and interact with notifications in native notification 26 // A class to display and interact with notifications in native notification
23 // centers on platforms that support it. 27 // centers on platforms that support it.
24 class NativeNotificationDisplayService : public NotificationDisplayService { 28 class NativeNotificationDisplayService : public NotificationDisplayService {
25 public: 29 public:
26 NativeNotificationDisplayService( 30 NativeNotificationDisplayService(
27 Profile* profile, 31 Profile* profile,
28 NotificationPlatformBridge* notification_bridge); 32 NotificationPlatformBridge* notification_bridge);
29 ~NativeNotificationDisplayService() override; 33 ~NativeNotificationDisplayService() override;
30 34
31 // NotificationDisplayService implementation. 35 // NotificationDisplayService implementation.
32 void Display(NotificationCommon::Type notification_type, 36 void Display(NotificationCommon::Type notification_type,
33 const std::string& notification_id, 37 const std::string& notification_id,
34 const Notification& notification) override; 38 const Notification& notification) override;
35 void Close(NotificationCommon::Type notification_type, 39 void Close(NotificationCommon::Type notification_type,
36 const std::string& notification_id) override; 40 const std::string& notification_id) override;
37 bool GetDisplayed(std::set<std::string>* notifications) const override; 41 bool GetDisplayed(std::set<std::string>* notifications) const override;
38 42
39 // Used by the notification bridge to propagate back events (click, close...). 43 // Used by the notification bridge to propagate back events (click, close...).
40 void ProcessNotificationOperation(NotificationCommon::Operation operation, 44 void ProcessNotificationOperation(NotificationCommon::Operation operation,
41 NotificationCommon::Type notification_type, 45 NotificationCommon::Type notification_type,
42 const std::string& origin, 46 const std::string& origin,
43 const std::string& notification_id, 47 const std::string& notification_id,
44 int action_index); 48 int action_index,
49 const base::NullableString16& reply);
45 50
46 // Registers an implementation object to handle notification operations 51 // Registers an implementation object to handle notification operations
47 // for |notification_type|. 52 // for |notification_type|.
48 void AddNotificationHandler(NotificationCommon::Type notification_type, 53 void AddNotificationHandler(NotificationCommon::Type notification_type,
49 std::unique_ptr<NotificationHandler> handler); 54 std::unique_ptr<NotificationHandler> handler);
50 55
51 // Removes an implementation added via |AddNotificationHandler|. 56 // Removes an implementation added via |AddNotificationHandler|.
52 void RemoveNotificationHandler(NotificationCommon::Type notification_type); 57 void RemoveNotificationHandler(NotificationCommon::Type notification_type);
53 58
54 private: 59 private:
55 NotificationHandler* GetNotificationHandler( 60 NotificationHandler* GetNotificationHandler(
56 NotificationCommon::Type notification_type); 61 NotificationCommon::Type notification_type);
57 62
58 Profile* profile_; 63 Profile* profile_;
59 NotificationPlatformBridge* notification_bridge_; 64 NotificationPlatformBridge* notification_bridge_;
60 std::map<NotificationCommon::Type, std::unique_ptr<NotificationHandler>> 65 std::map<NotificationCommon::Type, std::unique_ptr<NotificationHandler>>
61 notification_handlers_; 66 notification_handlers_;
62 67
63 DISALLOW_COPY_AND_ASSIGN(NativeNotificationDisplayService); 68 DISALLOW_COPY_AND_ASSIGN(NativeNotificationDisplayService);
64 }; 69 };
65 70
66 #endif // CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_ 71 #endif // CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698