Chromium Code Reviews| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 using ReadResultCallback = | 27 using ReadResultCallback = |
| 28 base::Callback<void(bool /* success */, | 28 base::Callback<void(bool /* success */, |
| 29 const NotificationDatabaseData&)>; | 29 const NotificationDatabaseData&)>; |
| 30 | 30 |
| 31 using ReadAllResultCallback = | 31 using ReadAllResultCallback = |
| 32 base::Callback<void(bool /* success */, | 32 base::Callback<void(bool /* success */, |
| 33 const std::vector<NotificationDatabaseData>&)>; | 33 const std::vector<NotificationDatabaseData>&)>; |
| 34 | 34 |
| 35 using WriteResultCallback = | 35 using WriteResultCallback = |
| 36 base::Callback<void(bool /* success */, | 36 base::Callback<void(bool /* success */, |
| 37 int64_t /* notification_id */)>; | 37 const std::string& /* notification_id */)>; |
| 38 | 38 |
| 39 using DeleteResultCallback = base::Callback<void(bool /* success */)>; | 39 using DeleteResultCallback = base::Callback<void(bool /* success */)>; |
| 40 | 40 |
| 41 // Reads the data associated with |notification_id| belonging to |origin| | 41 // Reads the data associated with |notification_id| belonging to |origin| |
| 42 // from the database. |callback| will be invoked with the success status | 42 // from the database. |callback| will be invoked with the success status |
| 43 // and a reference to the notification database data when completed. | 43 // and a reference to the notification database data when completed. |
| 44 virtual void ReadNotificationData(int64_t notification_id, | 44 virtual void ReadNotificationData(const std::string& notification_id, |
| 45 const GURL& origin, | 45 const GURL& origin, |
| 46 const ReadResultCallback& callback) = 0; | 46 const ReadResultCallback& callback) = 0; |
| 47 | 47 |
| 48 // Reads all data associated with |service_worker_registration_id| belonging | 48 // Reads all data associated with |service_worker_registration_id| belonging |
| 49 // to |origin| from the database. |callback| will be invoked with the success | 49 // to |origin| from the database. |callback| will be invoked with the success |
| 50 // status and a vector with all read notification data when completed. | 50 // status and a vector with all read notification data when completed. |
| 51 virtual void ReadAllNotificationDataForServiceWorkerRegistration( | 51 virtual void ReadAllNotificationDataForServiceWorkerRegistration( |
| 52 const GURL& origin, | 52 const GURL& origin, |
| 53 int64_t service_worker_registration_id, | 53 int64_t service_worker_registration_id, |
| 54 const ReadAllResultCallback& callback) = 0; | 54 const ReadAllResultCallback& callback) = 0; |
| 55 | 55 |
| 56 // Writes the data associated with a notification to a database. When this | 56 // Writes the data associated with a notification to a database. When this |
|
johnme
2016/09/08 15:21:50
Add "The |notification_id| field of |database_data
Peter Beverloo
2016/09/08 18:56:02
Done.
| |
| 57 // action completed, |callback| will be invoked with the success status and | 57 // action completed, |callback| will be invoked with the success status and |
| 58 // the persistent notification id when written successfully. | 58 // the persistent notification id when written successfully. |
|
johnme
2016/09/08 15:21:50
s/persistent //
Peter Beverloo
2016/09/08 18:56:03
Done.
| |
| 59 virtual void WriteNotificationData( | 59 virtual void WriteNotificationData( |
| 60 const GURL& origin, | 60 const GURL& origin, |
| 61 const NotificationDatabaseData& database_data, | 61 const NotificationDatabaseData& database_data, |
| 62 const WriteResultCallback& callback) = 0; | 62 const WriteResultCallback& callback) = 0; |
| 63 | 63 |
| 64 // Deletes all data associated with |notification_id| belonging to |origin| | 64 // Deletes all data associated with |notification_id| belonging to |origin| |
| 65 // from the database. |callback| will be invoked with the success status | 65 // from the database. |callback| will be invoked with the success status |
| 66 // when the operation has completed. | 66 // when the operation has completed. |
| 67 virtual void DeleteNotificationData(int64_t notification_id, | 67 virtual void DeleteNotificationData(const std::string& notification_id, |
| 68 const GURL& origin, | 68 const GURL& origin, |
| 69 const DeleteResultCallback& callback) = 0; | 69 const DeleteResultCallback& callback) = 0; |
| 70 | 70 |
| 71 protected: | 71 protected: |
| 72 friend class base::DeleteHelper<PlatformNotificationContext>; | 72 friend class base::DeleteHelper<PlatformNotificationContext>; |
| 73 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 73 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
| 74 | 74 |
| 75 virtual ~PlatformNotificationContext() {} | 75 virtual ~PlatformNotificationContext() {} |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace content | 78 } // namespace content |
| 79 | 79 |
| 80 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ | 80 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ |
| OLD | NEW |