| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 bool AreExtensionNotificationsAllowed() const; | 38 bool AreExtensionNotificationsAllowed() const; |
| 39 | 39 |
| 40 // Returns true if the API function is still allowed to run even when the | 40 // Returns true if the API function is still allowed to run even when the |
| 41 // notifications for a notifier have been disabled. | 41 // notifications for a notifier have been disabled. |
| 42 virtual bool CanRunWhileDisabled() const; | 42 virtual bool CanRunWhileDisabled() const; |
| 43 | 43 |
| 44 // Called inside of RunAsync. | 44 // Called inside of RunAsync. |
| 45 virtual bool RunNotificationsApi() = 0; | 45 virtual bool RunNotificationsApi() = 0; |
| 46 | 46 |
| 47 // UITHreadExtensionFunction: | 47 // UITHreadExtensionFunction: |
| 48 virtual bool RunAsync() OVERRIDE; | 48 virtual bool RunAsync() override; |
| 49 | 49 |
| 50 message_center::NotificationType MapApiTemplateTypeToType( | 50 message_center::NotificationType MapApiTemplateTypeToType( |
| 51 api::notifications::TemplateType type); | 51 api::notifications::TemplateType type); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class NotificationsCreateFunction : public NotificationsApiFunction { | 54 class NotificationsCreateFunction : public NotificationsApiFunction { |
| 55 public: | 55 public: |
| 56 NotificationsCreateFunction(); | 56 NotificationsCreateFunction(); |
| 57 | 57 |
| 58 // NotificationsApiFunction: | 58 // NotificationsApiFunction: |
| 59 virtual bool RunNotificationsApi() OVERRIDE; | 59 virtual bool RunNotificationsApi() override; |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 virtual ~NotificationsCreateFunction(); | 62 virtual ~NotificationsCreateFunction(); |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 scoped_ptr<api::notifications::Create::Params> params_; | 65 scoped_ptr<api::notifications::Create::Params> params_; |
| 66 | 66 |
| 67 DECLARE_EXTENSION_FUNCTION("notifications.create", NOTIFICATIONS_CREATE) | 67 DECLARE_EXTENSION_FUNCTION("notifications.create", NOTIFICATIONS_CREATE) |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 class NotificationsUpdateFunction : public NotificationsApiFunction { | 70 class NotificationsUpdateFunction : public NotificationsApiFunction { |
| 71 public: | 71 public: |
| 72 NotificationsUpdateFunction(); | 72 NotificationsUpdateFunction(); |
| 73 | 73 |
| 74 // NotificationsApiFunction: | 74 // NotificationsApiFunction: |
| 75 virtual bool RunNotificationsApi() OVERRIDE; | 75 virtual bool RunNotificationsApi() override; |
| 76 | 76 |
| 77 protected: | 77 protected: |
| 78 virtual ~NotificationsUpdateFunction(); | 78 virtual ~NotificationsUpdateFunction(); |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 scoped_ptr<api::notifications::Update::Params> params_; | 81 scoped_ptr<api::notifications::Update::Params> params_; |
| 82 | 82 |
| 83 DECLARE_EXTENSION_FUNCTION("notifications.update", NOTIFICATIONS_UPDATE) | 83 DECLARE_EXTENSION_FUNCTION("notifications.update", NOTIFICATIONS_UPDATE) |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 class NotificationsClearFunction : public NotificationsApiFunction { | 86 class NotificationsClearFunction : public NotificationsApiFunction { |
| 87 public: | 87 public: |
| 88 NotificationsClearFunction(); | 88 NotificationsClearFunction(); |
| 89 | 89 |
| 90 // NotificationsApiFunction: | 90 // NotificationsApiFunction: |
| 91 virtual bool RunNotificationsApi() OVERRIDE; | 91 virtual bool RunNotificationsApi() override; |
| 92 | 92 |
| 93 protected: | 93 protected: |
| 94 virtual ~NotificationsClearFunction(); | 94 virtual ~NotificationsClearFunction(); |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 scoped_ptr<api::notifications::Clear::Params> params_; | 97 scoped_ptr<api::notifications::Clear::Params> params_; |
| 98 | 98 |
| 99 DECLARE_EXTENSION_FUNCTION("notifications.clear", NOTIFICATIONS_CLEAR) | 99 DECLARE_EXTENSION_FUNCTION("notifications.clear", NOTIFICATIONS_CLEAR) |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 class NotificationsGetAllFunction : public NotificationsApiFunction { | 102 class NotificationsGetAllFunction : public NotificationsApiFunction { |
| 103 public: | 103 public: |
| 104 NotificationsGetAllFunction(); | 104 NotificationsGetAllFunction(); |
| 105 | 105 |
| 106 // NotificationsApiFunction: | 106 // NotificationsApiFunction: |
| 107 virtual bool RunNotificationsApi() OVERRIDE; | 107 virtual bool RunNotificationsApi() override; |
| 108 | 108 |
| 109 protected: | 109 protected: |
| 110 virtual ~NotificationsGetAllFunction(); | 110 virtual ~NotificationsGetAllFunction(); |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 DECLARE_EXTENSION_FUNCTION("notifications.getAll", NOTIFICATIONS_GET_ALL) | 113 DECLARE_EXTENSION_FUNCTION("notifications.getAll", NOTIFICATIONS_GET_ALL) |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 class NotificationsGetPermissionLevelFunction | 116 class NotificationsGetPermissionLevelFunction |
| 117 : public NotificationsApiFunction { | 117 : public NotificationsApiFunction { |
| 118 public: | 118 public: |
| 119 NotificationsGetPermissionLevelFunction(); | 119 NotificationsGetPermissionLevelFunction(); |
| 120 | 120 |
| 121 // NotificationsApiFunction: | 121 // NotificationsApiFunction: |
| 122 virtual bool CanRunWhileDisabled() const OVERRIDE; | 122 virtual bool CanRunWhileDisabled() const override; |
| 123 virtual bool RunNotificationsApi() OVERRIDE; | 123 virtual bool RunNotificationsApi() override; |
| 124 | 124 |
| 125 protected: | 125 protected: |
| 126 virtual ~NotificationsGetPermissionLevelFunction(); | 126 virtual ~NotificationsGetPermissionLevelFunction(); |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 DECLARE_EXTENSION_FUNCTION("notifications.getPermissionLevel", | 129 DECLARE_EXTENSION_FUNCTION("notifications.getPermissionLevel", |
| 130 NOTIFICATIONS_GET_ALL) | 130 NOTIFICATIONS_GET_ALL) |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 } // namespace extensions | 133 } // namespace extensions |
| 134 | 134 |
| 135 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_ | 135 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_NOTIFICATIONS_API_H_ |
| OLD | NEW |