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