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 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void WriteNotificationData(const GURL& origin, | 59 void WriteNotificationData(const GURL& origin, |
60 const NotificationDatabaseData& database_data, | 60 const NotificationDatabaseData& database_data, |
61 const WriteResultCallback& callback) override; | 61 const WriteResultCallback& callback) override; |
62 void DeleteNotificationData(int64_t notification_id, | 62 void DeleteNotificationData(int64_t notification_id, |
63 const GURL& origin, | 63 const GURL& origin, |
64 const DeleteResultCallback& callback) override; | 64 const DeleteResultCallback& callback) override; |
65 | 65 |
66 // ServiceWorkerContextObserver implementation. | 66 // ServiceWorkerContextObserver implementation. |
67 void OnRegistrationDeleted(int64_t registration_id, | 67 void OnRegistrationDeleted(int64_t registration_id, |
68 const GURL& pattern) override; | 68 const GURL& pattern) override; |
| 69 void OnStorageWiped() override; |
69 | 70 |
70 private: | 71 private: |
71 friend class base::DeleteHelper<PlatformNotificationContextImpl>; | 72 friend class base::DeleteHelper<PlatformNotificationContextImpl>; |
72 friend class base::RefCountedThreadSafe<PlatformNotificationContextImpl, | 73 friend class base::RefCountedThreadSafe<PlatformNotificationContextImpl, |
73 BrowserThread::DeleteOnUIThread>; | 74 BrowserThread::DeleteOnUIThread>; |
74 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 75 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
75 friend class PlatformNotificationContextTest; | 76 friend class PlatformNotificationContextTest; |
76 | 77 |
77 ~PlatformNotificationContextImpl() override; | 78 ~PlatformNotificationContextImpl() override; |
78 | 79 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 void DoDeleteNotificationData(int64_t notification_id, | 113 void DoDeleteNotificationData(int64_t notification_id, |
113 const GURL& origin, | 114 const GURL& origin, |
114 const DeleteResultCallback& callback); | 115 const DeleteResultCallback& callback); |
115 | 116 |
116 // Deletes all notifications associated with |service_worker_registration_id| | 117 // Deletes all notifications associated with |service_worker_registration_id| |
117 // belonging to |origin|. Must be called on the |task_runner_| thread. | 118 // belonging to |origin|. Must be called on the |task_runner_| thread. |
118 void DoDeleteNotificationsForServiceWorkerRegistration( | 119 void DoDeleteNotificationsForServiceWorkerRegistration( |
119 const GURL& origin, | 120 const GURL& origin, |
120 int64_t service_worker_registration_id); | 121 int64_t service_worker_registration_id); |
121 | 122 |
| 123 // Destroys the database regardless of its initialization status. This method |
| 124 // must only be called on the |task_runner_| thread. Returns if the directory |
| 125 // the database was stored in could be emptied. |
| 126 bool DestroyDatabase(); |
| 127 |
122 // Returns the path in which the database should be initialized. May be empty. | 128 // Returns the path in which the database should be initialized. May be empty. |
123 base::FilePath GetDatabasePath() const; | 129 base::FilePath GetDatabasePath() const; |
124 | 130 |
125 // Sets the task runner to use for testing purposes. | 131 // Sets the task runner to use for testing purposes. |
126 void SetTaskRunnerForTesting( | 132 void SetTaskRunnerForTesting( |
127 const scoped_refptr<base::SequencedTaskRunner>& task_runner); | 133 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
128 | 134 |
129 base::FilePath path_; | 135 base::FilePath path_; |
130 | 136 |
131 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 137 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
132 | 138 |
133 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 139 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
134 scoped_ptr<NotificationDatabase> database_; | 140 scoped_ptr<NotificationDatabase> database_; |
135 | 141 |
136 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationContextImpl); | 142 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationContextImpl); |
137 }; | 143 }; |
138 | 144 |
139 } // namespace content | 145 } // namespace content |
140 | 146 |
141 #endif // CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_ | 147 #endif // CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_ |
OLD | NEW |