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

Side by Side Diff: chrome/browser/extensions/api/notifications/notifications_api.h

Issue 12313115: Take notification API out of experimental. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict. Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_NOTIFICATIONS_NOTIFICATIONS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/extensions/api/api_function.h"
12 #include "chrome/browser/extensions/extension_function.h"
13 #include "chrome/common/extensions/api/notifications.h"
14 #include "ui/message_center/notification_types.h"
15
16 namespace extensions {
17
18 class NotificationsApiFunction : public ApiFunction {
19 public:
20 // Whether the current extension and channel allow the API. Public for
21 // testing.
22 bool IsNotificationsApiAvailable();
23
24 protected:
25 NotificationsApiFunction();
26 virtual ~NotificationsApiFunction();
27
28 void CreateNotification(
29 const std::string& id,
30 api::notifications::NotificationOptions* options);
31
32 bool IsNotificationsApiEnabled();
33
34 // Called inside of RunImpl.
35 virtual bool RunNotificationsApi() = 0;
36
37 // UITHreadExtensionFunction:
38 virtual bool RunImpl() OVERRIDE;
39
40 message_center::NotificationType MapApiTemplateTypeToType(
41 api::notifications::TemplateType type);
42 };
43
44 class NotificationsCreateFunction : public NotificationsApiFunction {
45 public:
46 NotificationsCreateFunction();
47
48 // UIThreadExtensionFunction:
49 virtual bool RunNotificationsApi() OVERRIDE;
50
51 protected:
52 virtual ~NotificationsCreateFunction();
53
54 private:
55 scoped_ptr<api::notifications::Create::Params> params_;
56
57 DECLARE_EXTENSION_FUNCTION("notifications.create", NOTIFICATIONS_CREATE)
58 };
59
60 class NotificationsUpdateFunction : public NotificationsApiFunction {
61 public:
62 NotificationsUpdateFunction();
63
64 // UIThreadExtensionFunction:
65 virtual bool RunNotificationsApi() OVERRIDE;
66
67 protected:
68 virtual ~NotificationsUpdateFunction();
69
70 private:
71 scoped_ptr<api::notifications::Update::Params> params_;
72
73 DECLARE_EXTENSION_FUNCTION("notifications.update", NOTIFICATIONS_UPDATE)
74 };
75
76 class NotificationsClearFunction : public NotificationsApiFunction {
77 public:
78 NotificationsClearFunction();
79
80 // UIThreadExtensionFunction:
81 virtual bool RunNotificationsApi() OVERRIDE;
82
83 protected:
84 virtual ~NotificationsClearFunction();
85
86 private:
87 scoped_ptr<api::notifications::Clear::Params> params_;
88
89 DECLARE_EXTENSION_FUNCTION("notifications.clear", NOTIFICATIONS_CLEAR)
90 };
91
92 } // namespace extensions
93
94 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698