| OLD | NEW |
| (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_NOTIFICATION_NOTIFICATION_API_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_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/experimental_notification.h" | |
| 14 #include "ui/message_center/notification_types.h" | |
| 15 | |
| 16 namespace extensions { | |
| 17 | |
| 18 class NotificationApiFunction : public ApiFunction { | |
| 19 protected: | |
| 20 NotificationApiFunction(); | |
| 21 virtual ~NotificationApiFunction(); | |
| 22 | |
| 23 void CreateNotification( | |
| 24 const std::string& id, | |
| 25 api::experimental_notification::NotificationOptions* options); | |
| 26 | |
| 27 bool IsNotificationApiEnabled(); | |
| 28 | |
| 29 // Called inside of RunImpl. | |
| 30 virtual bool RunNotificationApi() = 0; | |
| 31 | |
| 32 // UITHreadExtensionFunction: | |
| 33 virtual bool RunImpl() OVERRIDE; | |
| 34 | |
| 35 message_center::NotificationType MapApiTemplateTypeToType( | |
| 36 api::experimental_notification::TemplateType type); | |
| 37 }; | |
| 38 | |
| 39 class NotificationCreateFunction : public NotificationApiFunction { | |
| 40 public: | |
| 41 NotificationCreateFunction(); | |
| 42 | |
| 43 // UIThreadExtensionFunction: | |
| 44 virtual bool RunNotificationApi() OVERRIDE; | |
| 45 | |
| 46 protected: | |
| 47 virtual ~NotificationCreateFunction(); | |
| 48 | |
| 49 private: | |
| 50 scoped_ptr<api::experimental_notification::Create::Params> params_; | |
| 51 | |
| 52 DECLARE_EXTENSION_FUNCTION("experimental.notification.create", | |
| 53 EXPERIMENTAL_NOTIFICATION_CREATE) | |
| 54 }; | |
| 55 | |
| 56 class NotificationUpdateFunction : public NotificationApiFunction { | |
| 57 public: | |
| 58 NotificationUpdateFunction(); | |
| 59 | |
| 60 // UIThreadExtensionFunction: | |
| 61 virtual bool RunNotificationApi() OVERRIDE; | |
| 62 | |
| 63 protected: | |
| 64 virtual ~NotificationUpdateFunction(); | |
| 65 | |
| 66 private: | |
| 67 scoped_ptr<api::experimental_notification::Update::Params> params_; | |
| 68 | |
| 69 DECLARE_EXTENSION_FUNCTION("experimental.notification.update", | |
| 70 EXPERIMENTAL_NOTIFICATION_UPDATE) | |
| 71 }; | |
| 72 | |
| 73 class NotificationClearFunction : public NotificationApiFunction { | |
| 74 public: | |
| 75 NotificationClearFunction(); | |
| 76 | |
| 77 // UIThreadExtensionFunction: | |
| 78 virtual bool RunNotificationApi() OVERRIDE; | |
| 79 | |
| 80 protected: | |
| 81 virtual ~NotificationClearFunction(); | |
| 82 | |
| 83 private: | |
| 84 scoped_ptr<api::experimental_notification::Clear::Params> params_; | |
| 85 | |
| 86 DECLARE_EXTENSION_FUNCTION("experimental.notification.clear", | |
| 87 EXPERIMENTAL_NOTIFICATION_CLEAR) | |
| 88 }; | |
| 89 | |
| 90 } // namespace extensions | |
| 91 | |
| 92 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ | |
| OLD | NEW |