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

Side by Side Diff: chrome/browser/extensions/api/notification_provider/notification_provider_api.h

Issue 2659533003: Remove the notificationProvider extension API (Closed)
Patch Set: Remove the notificationProvider extension API Created 3 years, 10 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 2014 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_EXTENSIONS_API_NOTIFICATION_PROVIDER_NOTIFICATION_PROVIDE R_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_PROVIDER_NOTIFICATION_PROVIDE R_API_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/extensions/chrome_extension_function.h"
13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/extensions/api/notification_provider.h"
15 #include "extensions/browser/extension_function.h"
16 #include "ui/message_center/notification_types.h"
17
18 namespace extensions {
19
20 // Send events to the client. This will send events onCreated, onUpdated and
21 // onCleared to extensions/apps using this API.
22 class NotificationProviderEventRouter {
23 public:
24 explicit NotificationProviderEventRouter(Profile* profile);
25 virtual ~NotificationProviderEventRouter();
26
27 void CreateNotification(
28 const std::string& notification_provider_id,
29 const std::string& sender_id,
30 const std::string& notification_id,
31 const api::notifications::NotificationOptions& options);
32 void UpdateNotification(
33 const std::string& notification_provider_id,
34 const std::string& sender_id,
35 const std::string& notificaiton_id,
36 const api::notifications::NotificationOptions& options);
37 void ClearNotification(const std::string& notification_provider_id,
38 const std::string& sender_id,
39 const std::string& notification_id);
40
41 private:
42 void Create(const std::string& notification_provider_id,
43 const std::string& sender_id,
44 const std::string& notification_id,
45 const api::notifications::NotificationOptions& options);
46 void Update(const std::string& notification_provider_id,
47 const std::string& sender_id,
48 const std::string& notification_id,
49 const api::notifications::NotificationOptions& options);
50 void Clear(const std::string& notification_provider_id,
51 const std::string& sender_id,
52 const std::string& notification_id);
53
54 Profile* profile_;
55
56 DISALLOW_COPY_AND_ASSIGN(NotificationProviderEventRouter);
57 };
58
59 // Implememtation of NotifyOnCleared function of the API. It will inform the
60 // notifier that the user cleared a notification sent from that notifier.
61 class NotificationProviderNotifyOnClearedFunction
62 : public ChromeUIThreadExtensionFunction {
63 public:
64 NotificationProviderNotifyOnClearedFunction();
65
66 protected:
67 ~NotificationProviderNotifyOnClearedFunction() override;
68
69 private:
70 DECLARE_EXTENSION_FUNCTION("notificationProvider.notifyOnCleared",
71 NOTIFICATIONPROVIDER_NOTIFYONCLEARED);
72
73 // UIThreadExtensionFunction implementation.
74 ExtensionFunction::ResponseAction Run() override;
75 };
76
77 // Implememtation of NotifyOnClicked function of the API. It will inform the
78 // notifier that the user clicked in a non-button area of a notification sent
79 // from that notifier.
80 class NotificationProviderNotifyOnClickedFunction
81 : public ChromeUIThreadExtensionFunction {
82 public:
83 NotificationProviderNotifyOnClickedFunction();
84
85 protected:
86 ~NotificationProviderNotifyOnClickedFunction() override;
87
88 private:
89 DECLARE_EXTENSION_FUNCTION("notificationProvider.notifyOnClicked",
90 NOTIFICATIONPROVIDER_NOTIFYONCLICKED);
91
92 // UIThreadExtensionFunction implementation.
93 ExtensionFunction::ResponseAction Run() override;
94 };
95
96 // Implememtation of NotifyOnButtonClicked function of the API. It will inform
97 // the
98 // notifier that the user pressed a button in the notification sent from that
99 // notifier.
100 class NotificationProviderNotifyOnButtonClickedFunction
101 : public ChromeUIThreadExtensionFunction {
102 public:
103 NotificationProviderNotifyOnButtonClickedFunction();
104
105 protected:
106 ~NotificationProviderNotifyOnButtonClickedFunction() override;
107
108 private:
109 DECLARE_EXTENSION_FUNCTION("notificationProvider.notifyOnButtonClicked",
110 NOTIFICATIONPROVIDER_NOTIFYONBUTTONCLICKED);
111
112 // UIThreadExtensionFunction implementation.
113 ExtensionFunction::ResponseAction Run() override;
114 };
115
116 // Implememtation of NotifyOnPermissionLevelChanged function of the API. It will
117 // inform the notifier that the user changed the permission level of that
118 // notifier.
119 class NotificationProviderNotifyOnPermissionLevelChangedFunction
120 : public ChromeUIThreadExtensionFunction {
121 public:
122 NotificationProviderNotifyOnPermissionLevelChangedFunction();
123
124 protected:
125 ~NotificationProviderNotifyOnPermissionLevelChangedFunction() override;
126
127 private:
128 DECLARE_EXTENSION_FUNCTION(
129 "notificationProvider.notifyOnPermissionLevelChanged",
130 NOTIFICATIONPROVIDER_NOTIFYONPERMISSIONLEVELCHANGED);
131
132 // UIThreadExtensionFunction implementation.
133 ExtensionFunction::ResponseAction Run() override;
134 };
135
136 // Implememtation of NotifyOnShowSettings function of the API. It will inform
137 // the notifier that the user clicked on advanced settings of that notifier.
138 class NotificationProviderNotifyOnShowSettingsFunction
139 : public ChromeUIThreadExtensionFunction {
140 public:
141 NotificationProviderNotifyOnShowSettingsFunction();
142
143 protected:
144 ~NotificationProviderNotifyOnShowSettingsFunction() override;
145
146 private:
147 DECLARE_EXTENSION_FUNCTION("notificationProvider.notifyOnShowSettings",
148 NOTIFICATIONPROVIDER_NOTIFYONSHOWSETTINGS);
149
150 // UIThreadExtensionFunction implementation.
151 ExtensionFunction::ResponseAction Run() override;
152 };
153
154 // Implememtation of GetNotifier function of the API. It will get the notifier
155 // object that corresponds to the notifier ID.
156 class NotificationProviderGetNotifierFunction
157 : public ChromeUIThreadExtensionFunction {
158 public:
159 NotificationProviderGetNotifierFunction();
160
161 protected:
162 ~NotificationProviderGetNotifierFunction() override;
163
164 private:
165 DECLARE_EXTENSION_FUNCTION("notificationProvider.getNotifier",
166 NOTIFICATIONPROVIDER_GETNOTIFIER);
167
168 // UIThreadExtensionFunction implementation.
169 ExtensionFunction::ResponseAction Run() override;
170 };
171
172 // Implememtation of GetAllNotifiers function of the API. It will get all the
173 // notifiers that would send notifications.
174 class NotificationProviderGetAllNotifiersFunction
175 : public ChromeUIThreadExtensionFunction {
176 public:
177 NotificationProviderGetAllNotifiersFunction();
178
179 protected:
180 ~NotificationProviderGetAllNotifiersFunction() override;
181
182 private:
183 DECLARE_EXTENSION_FUNCTION("notificationProvider.getAllNotifiers",
184 NOTIFICATIONPROVIDER_GETALLNOTIFIERS);
185
186 // UIThreadExtensionFunction implementation.
187 ExtensionFunction::ResponseAction Run() override;
188 };
189
190 } // namespace extensions
191
192 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_PROVIDER_NOTIFICATION_PROV IDER_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698