Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 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_GETTER_NOTIFICATION_GETTER_AP I_H_ | |
|
Pete Williamson
2014/06/30 19:03:48
You already know this, but as a reminder, let's ch
liyanhou
2014/07/14 17:44:44
Done.
| |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_GETTER_NOTIFICATION_GETTER_AP I_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "chrome/browser/extensions/chrome_extension_function.h" | |
| 12 #include "chrome/browser/profiles/profile.h" | |
| 13 #include "chrome/common/extensions/api/notification_getter.h" | |
| 14 #include "extensions/browser/extension_function.h" | |
| 15 #include "ui/message_center/notification_types.h" | |
| 16 | |
| 17 namespace extensions { | |
| 18 | |
| 19 class NotificationGetterEventRouter { | |
|
Pete Williamson
2014/06/30 19:03:48
Let's add a class level comment here: A quick desc
liyanhou
2014/07/14 17:44:44
Done.
| |
| 20 public: | |
| 21 explicit NotificationGetterEventRouter(Profile* profile); | |
| 22 virtual ~NotificationGetterEventRouter(); | |
| 23 | |
| 24 // For testing purposes. | |
| 25 void CreateNotificationForTest( | |
| 26 const std::string& extension_id, | |
| 27 const std::string& sender_id, | |
| 28 const std::string& notification_id, | |
| 29 const extensions::api::notification_getter::NotificationOptions& options); | |
| 30 void UpdateNotificationForTest( | |
| 31 const std::string& extension_id, | |
| 32 const std::string& sender_id, | |
| 33 const std::string& notificaiton_id, | |
| 34 const extensions::api::notification_getter::NotificationOptions& options); | |
| 35 void CloseNotificationForTest(const std::string& extension_id, | |
| 36 const std::string& sender_id, | |
| 37 const std::string& notification_id); | |
| 38 | |
| 39 private: | |
| 40 void Create( | |
| 41 const std::string& extension_id, | |
| 42 const std::string& sender_id, | |
| 43 const std::string& notification_id, | |
| 44 const extensions::api::notification_getter::NotificationOptions& options); | |
| 45 void Update( | |
| 46 const std::string& extension_id, | |
| 47 const std::string& sender_id, | |
| 48 const std::string& notification_id, | |
| 49 const extensions::api::notification_getter::NotificationOptions& options); | |
| 50 void Close(const std::string& extension_id, | |
| 51 const std::string& sender_id, | |
| 52 const std::string& notification_id); | |
| 53 | |
| 54 Profile* profile_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(NotificationGetterEventRouter); | |
| 57 }; | |
| 58 | |
| 59 class NotificationGetterSendOnCloseFunction | |
| 60 : public ChromeAsyncExtensionFunction { | |
| 61 public: | |
| 62 NotificationGetterSendOnCloseFunction(); | |
| 63 | |
| 64 virtual bool RunAsync() OVERRIDE; | |
| 65 | |
| 66 protected: | |
| 67 virtual ~NotificationGetterSendOnCloseFunction(); | |
| 68 | |
| 69 private: | |
| 70 scoped_ptr<api::notification_getter::SendOnClose::Params> params_; | |
| 71 | |
| 72 DECLARE_EXTENSION_FUNCTION("notificationGetter.sendOnClose", | |
| 73 NOTIFICATIONGETTER_SENDONCLOSE) | |
| 74 }; | |
| 75 | |
| 76 class NotificationGetterSendOnClickFunction | |
| 77 : public ChromeAsyncExtensionFunction { | |
| 78 public: | |
| 79 NotificationGetterSendOnClickFunction(); | |
| 80 | |
| 81 virtual bool RunAsync() OVERRIDE; | |
| 82 | |
| 83 protected: | |
| 84 virtual ~NotificationGetterSendOnClickFunction(); | |
| 85 | |
| 86 private: | |
| 87 scoped_ptr<api::notification_getter::SendOnClick::Params> params_; | |
| 88 | |
| 89 DECLARE_EXTENSION_FUNCTION("notificationGetter.sendOnClick", | |
| 90 NOTIFICATIONGETTER_SENDONCLICK) | |
| 91 }; | |
| 92 | |
| 93 class NotificationGetterSendOnClickButtonFunction | |
| 94 : public ChromeAsyncExtensionFunction { | |
| 95 public: | |
| 96 NotificationGetterSendOnClickButtonFunction(); | |
| 97 | |
| 98 virtual bool RunAsync() OVERRIDE; | |
| 99 | |
| 100 protected: | |
| 101 virtual ~NotificationGetterSendOnClickButtonFunction(); | |
| 102 | |
| 103 private: | |
| 104 scoped_ptr<api::notification_getter::SendOnClickButton::Params> params_; | |
| 105 | |
| 106 DECLARE_EXTENSION_FUNCTION("notificationGetter.sendOnClickButton", | |
| 107 NOTIFICATIONGETTER_SENDONCLICKBUTTON) | |
| 108 }; | |
| 109 | |
| 110 class NotificationGetterNotifyPermissionLevelChangedFunction | |
| 111 : public ChromeAsyncExtensionFunction { | |
| 112 public: | |
| 113 NotificationGetterNotifyPermissionLevelChangedFunction(); | |
| 114 | |
| 115 virtual bool RunAsync() OVERRIDE; | |
| 116 | |
| 117 protected: | |
| 118 virtual ~NotificationGetterNotifyPermissionLevelChangedFunction(); | |
| 119 | |
| 120 private: | |
| 121 scoped_ptr<api::notification_getter::NotifyPermissionLevelChanged::Params> | |
| 122 params_; | |
| 123 | |
| 124 DECLARE_EXTENSION_FUNCTION("notificationGetter.notifyPermissionLevelChanged", | |
| 125 NOTIFICATIONGETTER_NOTIFYPERMISSIONLEVELCHANGED) | |
| 126 }; | |
| 127 | |
| 128 } // namespace extensions | |
| 129 | |
| 130 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_GETTER_NOTIFICATION_GETTER _API_H_ | |
| OLD | NEW |