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_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_ |
6 #define CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_ | 6 #define CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <memory> |
| 10 #include <set> |
9 #include <string> | 11 #include <string> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/callback.h" | 14 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
14 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 17 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
17 #include "content/browser/notifications/notification_id_generator.h" | 19 #include "content/browser/notifications/notification_id_generator.h" |
18 #include "content/browser/service_worker/service_worker_context_observer.h" | 20 #include "content/browser/service_worker/service_worker_context_observer.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void OpenDatabase(const base::Closure& success_closure, | 121 void OpenDatabase(const base::Closure& success_closure, |
120 const base::Closure& failure_closure); | 122 const base::Closure& failure_closure); |
121 | 123 |
122 // Actually reads the notification data from the database. Must only be | 124 // Actually reads the notification data from the database. Must only be |
123 // called on the |task_runner_| thread. |callback| will be invoked on the | 125 // called on the |task_runner_| thread. |callback| will be invoked on the |
124 // IO thread when the operation has completed. | 126 // IO thread when the operation has completed. |
125 void DoReadNotificationData(const std::string& notification_id, | 127 void DoReadNotificationData(const std::string& notification_id, |
126 const GURL& origin, | 128 const GURL& origin, |
127 const ReadResultCallback& callback); | 129 const ReadResultCallback& callback); |
128 | 130 |
| 131 // Updates the database (and the result callback) based on |
| 132 // |displayed_notifications| |
| 133 // if |sync_supported|. Called on the IO thread. |
| 134 void SynchronizeDisplayedNotificationsForServiceWorkerRegistration( |
| 135 const GURL& origin, |
| 136 int64_t service_worker_registration_id, |
| 137 const ReadAllResultCallback& callback, |
| 138 std::unique_ptr<std::set<std::string>> displayed_notifications, |
| 139 bool sync_supported); |
| 140 |
129 // Actually reads all notification data from the database. Must only be | 141 // Actually reads all notification data from the database. Must only be |
130 // called on the |task_runner_| thread. |callback| will be invoked on the | 142 // called on the |task_runner_| thread. |callback| will be invoked on the |
131 // IO thread when the operation has completed. | 143 // IO thread when the operation has completed. |
132 void DoReadAllNotificationDataForServiceWorkerRegistration( | 144 void DoReadAllNotificationDataForServiceWorkerRegistration( |
133 const GURL& origin, | 145 const GURL& origin, |
134 int64_t service_worker_registration_id, | 146 int64_t service_worker_registration_id, |
135 const ReadAllResultCallback& callback); | 147 const ReadAllResultCallback& callback, |
| 148 std::unique_ptr<std::set<std::string>> displayed_notifications, |
| 149 bool synchronization_supported); |
136 | 150 |
137 // Actually writes the notification database to the database. Must only be | 151 // Actually writes the notification database to the database. Must only be |
138 // called on the |task_runner_| thread. |callback| will be invoked on the | 152 // called on the |task_runner_| thread. |callback| will be invoked on the |
139 // IO thread when the operation has completed. | 153 // IO thread when the operation has completed. |
140 void DoWriteNotificationData(const GURL& origin, | 154 void DoWriteNotificationData(const GURL& origin, |
141 const NotificationDatabaseData& database_data, | 155 const NotificationDatabaseData& database_data, |
142 const WriteResultCallback& callback); | 156 const WriteResultCallback& callback); |
143 | 157 |
144 // Actually deletes the notification information from the database. Must only | 158 // Actually deletes the notification information from the database. Must only |
145 // be called on the |task_runner_| thread. |callback| will be invoked on the | 159 // be called on the |task_runner_| thread. |callback| will be invoked on the |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // The notification services are owned by the platform context, and will be | 196 // The notification services are owned by the platform context, and will be |
183 // removed when either this class is destroyed or the Mojo pipe disconnects. | 197 // removed when either this class is destroyed or the Mojo pipe disconnects. |
184 std::vector<std::unique_ptr<BlinkNotificationServiceImpl>> services_; | 198 std::vector<std::unique_ptr<BlinkNotificationServiceImpl>> services_; |
185 | 199 |
186 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationContextImpl); | 200 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationContextImpl); |
187 }; | 201 }; |
188 | 202 |
189 } // namespace content | 203 } // namespace content |
190 | 204 |
191 #endif // CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_ | 205 #endif // CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_ |
OLD | NEW |