| 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_NOTIFICATION_NOTIFICATION_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_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/experimental_notification.h" | 13 #include "chrome/common/extensions/api/experimental_notification.h" |
| 14 #include "ui/notifications/notification_types.h" | 14 #include "ui/message_center/notification_types.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 class NotificationApiFunction : public ApiFunction { | 18 class NotificationApiFunction : public ApiFunction { |
| 19 protected: | 19 protected: |
| 20 NotificationApiFunction(); | 20 NotificationApiFunction(); |
| 21 virtual ~NotificationApiFunction(); | 21 virtual ~NotificationApiFunction(); |
| 22 | 22 |
| 23 void CreateNotification( | 23 void CreateNotification( |
| 24 const std::string& id, | 24 const std::string& id, |
| 25 api::experimental_notification::NotificationOptions* options); | 25 api::experimental_notification::NotificationOptions* options); |
| 26 | 26 |
| 27 bool IsNotificationApiEnabled(); | 27 bool IsNotificationApiEnabled(); |
| 28 | 28 |
| 29 // Called inside of RunImpl. | 29 // Called inside of RunImpl. |
| 30 virtual bool RunNotificationApi() = 0; | 30 virtual bool RunNotificationApi() = 0; |
| 31 | 31 |
| 32 // UITHreadExtensionFunction: | 32 // UITHreadExtensionFunction: |
| 33 virtual bool RunImpl() OVERRIDE; | 33 virtual bool RunImpl() OVERRIDE; |
| 34 | 34 |
| 35 ui::notifications::NotificationType MapApiTemplateTypeToType( | 35 message_center::NotificationType MapApiTemplateTypeToType( |
| 36 api::experimental_notification::TemplateType type); | 36 api::experimental_notification::TemplateType type); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 class NotificationCreateFunction : public NotificationApiFunction { | 39 class NotificationCreateFunction : public NotificationApiFunction { |
| 40 public: | 40 public: |
| 41 NotificationCreateFunction(); | 41 NotificationCreateFunction(); |
| 42 | 42 |
| 43 // UIThreadExtensionFunction: | 43 // UIThreadExtensionFunction: |
| 44 virtual bool RunNotificationApi() OVERRIDE; | 44 virtual bool RunNotificationApi() OVERRIDE; |
| 45 | 45 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 private: | 83 private: |
| 84 scoped_ptr<api::experimental_notification::Delete::Params> params_; | 84 scoped_ptr<api::experimental_notification::Delete::Params> params_; |
| 85 | 85 |
| 86 DECLARE_EXTENSION_FUNCTION("experimental.notification.delete", | 86 DECLARE_EXTENSION_FUNCTION("experimental.notification.delete", |
| 87 EXPERIMENTAL_NOTIFICATION_DELETE) | 87 EXPERIMENTAL_NOTIFICATION_DELETE) |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace extensions | 90 } // namespace extensions |
| 91 | 91 |
| 92 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ | 92 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATION_NOTIFICATION_API_H_ |
| OLD | NEW |