| 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_NOTIFICATIONS_NOTIFICATIONS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/extensions/api/api_function.h" | 11 #include "chrome/browser/extensions/api/api_function.h" |
| 12 #include "chrome/browser/extensions/extension_function.h" | 12 #include "chrome/browser/extensions/extension_function.h" |
| 13 #include "chrome/common/extensions/api/notifications.h" | 13 #include "chrome/common/extensions/api/notifications.h" |
| 14 #include "ui/message_center/notification_types.h" | 14 #include "ui/message_center/notification_types.h" |
| 15 | 15 |
| 16 class Notification; |
| 17 |
| 16 namespace extensions { | 18 namespace extensions { |
| 17 | 19 |
| 18 class NotificationsApiFunction : public ApiFunction { | 20 class NotificationsApiFunction : public ApiFunction { |
| 19 public: | 21 public: |
| 20 // Whether the current extension and channel allow the API. Public for | 22 // Whether the current extension and channel allow the API. Public for |
| 21 // testing. | 23 // testing. |
| 22 bool IsNotificationsApiAvailable(); | 24 bool IsNotificationsApiAvailable(); |
| 23 | 25 |
| 24 protected: | 26 protected: |
| 25 NotificationsApiFunction(); | 27 NotificationsApiFunction(); |
| 26 virtual ~NotificationsApiFunction(); | 28 virtual ~NotificationsApiFunction(); |
| 27 | 29 |
| 28 bool CreateNotification(const std::string& id, | 30 bool CreateNotification(const std::string& id, |
| 29 api::notifications::NotificationOptions* options); | 31 api::notifications::NotificationOptions* options); |
| 32 bool UpdateNotification(const std::string& id, |
| 33 api::notifications::NotificationOptions* options, |
| 34 Notification* notification); |
| 30 | 35 |
| 31 bool IsNotificationsApiEnabled(); | 36 bool IsNotificationsApiEnabled(); |
| 32 | 37 |
| 33 // Called inside of RunImpl. | 38 // Called inside of RunImpl. |
| 34 virtual bool RunNotificationsApi() = 0; | 39 virtual bool RunNotificationsApi() = 0; |
| 35 | 40 |
| 36 // UITHreadExtensionFunction: | 41 // UITHreadExtensionFunction: |
| 37 virtual bool RunImpl() OVERRIDE; | 42 virtual bool RunImpl() OVERRIDE; |
| 38 | 43 |
| 39 message_center::NotificationType MapApiTemplateTypeToType( | 44 message_center::NotificationType MapApiTemplateTypeToType( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 protected: | 103 protected: |
| 99 virtual ~NotificationsGetAllFunction(); | 104 virtual ~NotificationsGetAllFunction(); |
| 100 | 105 |
| 101 private: | 106 private: |
| 102 DECLARE_EXTENSION_FUNCTION("notifications.getAll", NOTIFICATIONS_GET_ALL) | 107 DECLARE_EXTENSION_FUNCTION("notifications.getAll", NOTIFICATIONS_GET_ALL) |
| 103 }; | 108 }; |
| 104 | 109 |
| 105 } // namespace extensions | 110 } // namespace extensions |
| 106 | 111 |
| 107 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_ | 112 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_ |
| OLD | NEW |