OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
9 #include "chrome/browser/extensions/api/api_function.h" | 11 #include "chrome/browser/extensions/api/api_function.h" |
10 #include "chrome/browser/extensions/extension_function.h" | 12 #include "chrome/browser/extensions/extension_function.h" |
11 #include "chrome/common/extensions/api/experimental_notification.h" | 13 #include "chrome/common/extensions/api/experimental_notification.h" |
12 | 14 #include "ui/notifications/notification_types.h" |
13 #include <string> | |
14 | 15 |
15 namespace extensions { | 16 namespace extensions { |
16 | 17 |
17 class NotificationApiFunction : public ApiFunction { | 18 class NotificationApiFunction : public ApiFunction { |
18 protected: | 19 protected: |
19 NotificationApiFunction(); | 20 NotificationApiFunction(); |
20 virtual ~NotificationApiFunction(); | 21 virtual ~NotificationApiFunction(); |
21 | 22 |
22 void CreateNotification( | 23 void CreateNotification( |
23 const std::string& id, | 24 const std::string& id, |
24 api::experimental_notification::NotificationOptions* options); | 25 api::experimental_notification::NotificationOptions* options); |
25 | 26 |
26 bool IsNotificationApiEnabled(); | 27 bool IsNotificationApiEnabled(); |
27 | 28 |
28 // Called inside of RunImpl. | 29 // Called inside of RunImpl. |
29 virtual bool RunNotificationApi() = 0; | 30 virtual bool RunNotificationApi() = 0; |
30 | 31 |
31 // UITHreadExtensionFunction: | 32 // UITHreadExtensionFunction: |
32 virtual bool RunImpl() OVERRIDE; | 33 virtual bool RunImpl() OVERRIDE; |
| 34 |
| 35 ui::notifications::NotificationType MapApiTemplateTypeToType( |
| 36 api::experimental_notification::TemplateType type); |
33 }; | 37 }; |
34 | 38 |
35 class NotificationCreateFunction : public NotificationApiFunction { | 39 class NotificationCreateFunction : public NotificationApiFunction { |
36 public: | 40 public: |
37 NotificationCreateFunction(); | 41 NotificationCreateFunction(); |
38 | 42 |
39 // UIThreadExtensionFunction: | 43 // UIThreadExtensionFunction: |
40 virtual bool RunNotificationApi() OVERRIDE; | 44 virtual bool RunNotificationApi() OVERRIDE; |
41 | 45 |
42 protected: | 46 protected: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 private: | 83 private: |
80 scoped_ptr<api::experimental_notification::Delete::Params> params_; | 84 scoped_ptr<api::experimental_notification::Delete::Params> params_; |
81 | 85 |
82 DECLARE_EXTENSION_FUNCTION("experimental.notification.delete", | 86 DECLARE_EXTENSION_FUNCTION("experimental.notification.delete", |
83 EXPERIMENTAL_NOTIFICATION_DELETE) | 87 EXPERIMENTAL_NOTIFICATION_DELETE) |
84 }; | 88 }; |
85 | 89 |
86 } // namespace extensions | 90 } // namespace extensions |
87 | 91 |
88 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ | 92 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ |
OLD | NEW |