Chromium Code Reviews| Index: chrome/browser/extensions/api/notification_getter/notification_getter_api.h |
| diff --git a/chrome/browser/extensions/api/notification_getter/notification_getter_api.h b/chrome/browser/extensions/api/notification_getter/notification_getter_api.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e8d90eebc67292c44174f874d2137b9c9d13684b |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/notification_getter/notification_getter_api.h |
| @@ -0,0 +1,130 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_GETTER_NOTIFICATION_GETTER_API_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.
|
| +#define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_GETTER_NOTIFICATION_GETTER_API_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "chrome/browser/extensions/chrome_extension_function.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/common/extensions/api/notification_getter.h" |
| +#include "extensions/browser/extension_function.h" |
| +#include "ui/message_center/notification_types.h" |
| + |
| +namespace extensions { |
| + |
| +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.
|
| + public: |
| + explicit NotificationGetterEventRouter(Profile* profile); |
| + virtual ~NotificationGetterEventRouter(); |
| + |
| + // For testing purposes. |
| + void CreateNotificationForTest( |
| + const std::string& extension_id, |
| + const std::string& sender_id, |
| + const std::string& notification_id, |
| + const extensions::api::notification_getter::NotificationOptions& options); |
| + void UpdateNotificationForTest( |
| + const std::string& extension_id, |
| + const std::string& sender_id, |
| + const std::string& notificaiton_id, |
| + const extensions::api::notification_getter::NotificationOptions& options); |
| + void CloseNotificationForTest(const std::string& extension_id, |
| + const std::string& sender_id, |
| + const std::string& notification_id); |
| + |
| + private: |
| + void Create( |
| + const std::string& extension_id, |
| + const std::string& sender_id, |
| + const std::string& notification_id, |
| + const extensions::api::notification_getter::NotificationOptions& options); |
| + void Update( |
| + const std::string& extension_id, |
| + const std::string& sender_id, |
| + const std::string& notification_id, |
| + const extensions::api::notification_getter::NotificationOptions& options); |
| + void Close(const std::string& extension_id, |
| + const std::string& sender_id, |
| + const std::string& notification_id); |
| + |
| + Profile* profile_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NotificationGetterEventRouter); |
| +}; |
| + |
| +class NotificationGetterSendOnCloseFunction |
| + : public ChromeAsyncExtensionFunction { |
| + public: |
| + NotificationGetterSendOnCloseFunction(); |
| + |
| + virtual bool RunAsync() OVERRIDE; |
| + |
| + protected: |
| + virtual ~NotificationGetterSendOnCloseFunction(); |
| + |
| + private: |
| + scoped_ptr<api::notification_getter::SendOnClose::Params> params_; |
| + |
| + DECLARE_EXTENSION_FUNCTION("notificationGetter.sendOnClose", |
| + NOTIFICATIONGETTER_SENDONCLOSE) |
| +}; |
| + |
| +class NotificationGetterSendOnClickFunction |
| + : public ChromeAsyncExtensionFunction { |
| + public: |
| + NotificationGetterSendOnClickFunction(); |
| + |
| + virtual bool RunAsync() OVERRIDE; |
| + |
| + protected: |
| + virtual ~NotificationGetterSendOnClickFunction(); |
| + |
| + private: |
| + scoped_ptr<api::notification_getter::SendOnClick::Params> params_; |
| + |
| + DECLARE_EXTENSION_FUNCTION("notificationGetter.sendOnClick", |
| + NOTIFICATIONGETTER_SENDONCLICK) |
| +}; |
| + |
| +class NotificationGetterSendOnClickButtonFunction |
| + : public ChromeAsyncExtensionFunction { |
| + public: |
| + NotificationGetterSendOnClickButtonFunction(); |
| + |
| + virtual bool RunAsync() OVERRIDE; |
| + |
| + protected: |
| + virtual ~NotificationGetterSendOnClickButtonFunction(); |
| + |
| + private: |
| + scoped_ptr<api::notification_getter::SendOnClickButton::Params> params_; |
| + |
| + DECLARE_EXTENSION_FUNCTION("notificationGetter.sendOnClickButton", |
| + NOTIFICATIONGETTER_SENDONCLICKBUTTON) |
| +}; |
| + |
| +class NotificationGetterNotifyPermissionLevelChangedFunction |
| + : public ChromeAsyncExtensionFunction { |
| + public: |
| + NotificationGetterNotifyPermissionLevelChangedFunction(); |
| + |
| + virtual bool RunAsync() OVERRIDE; |
| + |
| + protected: |
| + virtual ~NotificationGetterNotifyPermissionLevelChangedFunction(); |
| + |
| + private: |
| + scoped_ptr<api::notification_getter::NotifyPermissionLevelChanged::Params> |
| + params_; |
| + |
| + DECLARE_EXTENSION_FUNCTION("notificationGetter.notifyPermissionLevelChanged", |
| + NOTIFICATIONGETTER_NOTIFYPERMISSIONLEVELCHANGED) |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_GETTER_NOTIFICATION_GETTER_API_H_ |