| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" | |
| 12 | 11 |
| 13 class GURL; | 12 class GURL; |
| 14 | 13 |
| 15 namespace content { | 14 namespace content { |
| 16 | 15 |
| 17 struct NotificationDatabaseData; | 16 struct NotificationDatabaseData; |
| 18 | 17 |
| 19 // Represents the storage context for persistent Web Notifications, specific to | 18 // Represents the storage context for persistent Web Notifications, specific to |
| 20 // the storage partition owning the instance. All methods defined in this | 19 // the storage partition owning the instance. All methods defined in this |
| 21 // interface may only be used on the IO thread. | 20 // interface may only be used on the IO thread. |
| 22 class PlatformNotificationContext | 21 class PlatformNotificationContext { |
| 23 : public base::RefCountedThreadSafe<PlatformNotificationContext> { | |
| 24 public: | 22 public: |
| 25 using ReadResultCallback = | 23 using ReadResultCallback = |
| 26 base::Callback<void(bool /* success */, | 24 base::Callback<void(bool /* success */, |
| 27 const NotificationDatabaseData&)>; | 25 const NotificationDatabaseData&)>; |
| 28 | 26 |
| 29 using WriteResultCallback = | 27 using WriteResultCallback = |
| 30 base::Callback<void(bool /* success */, | 28 base::Callback<void(bool /* success */, |
| 31 int64_t /* notification_id */)>; | 29 int64_t /* notification_id */)>; |
| 32 | 30 |
| 33 using DeleteResultCallback = base::Callback<void(bool /* success */)>; | 31 using DeleteResultCallback = base::Callback<void(bool /* success */)>; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 48 const WriteResultCallback& callback) = 0; | 46 const WriteResultCallback& callback) = 0; |
| 49 | 47 |
| 50 // Deletes all data associated with |notification_id| belonging to |origin| | 48 // Deletes all data associated with |notification_id| belonging to |origin| |
| 51 // from the database. |callback| will be invoked with the success status | 49 // from the database. |callback| will be invoked with the success status |
| 52 // when the operation has completed. | 50 // when the operation has completed. |
| 53 virtual void DeleteNotificationData(int64_t notification_id, | 51 virtual void DeleteNotificationData(int64_t notification_id, |
| 54 const GURL& origin, | 52 const GURL& origin, |
| 55 const DeleteResultCallback& callback) = 0; | 53 const DeleteResultCallback& callback) = 0; |
| 56 | 54 |
| 57 protected: | 55 protected: |
| 58 friend class base::RefCountedThreadSafe<PlatformNotificationContext>; | |
| 59 | |
| 60 virtual ~PlatformNotificationContext() {} | 56 virtual ~PlatformNotificationContext() {} |
| 61 }; | 57 }; |
| 62 | 58 |
| 63 } // namespace content | 59 } // namespace content |
| 64 | 60 |
| 65 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ | 61 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ |
| OLD | NEW |