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> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "content/browser/notifications/notification_id_generator.h" | 19 #include "content/browser/notifications/notification_id_generator.h" |
20 #include "content/browser/service_worker/service_worker_context_observer.h" | 20 #include "content/browser/service_worker/service_worker_context_core_observer.h" |
21 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/platform_notification_context.h" | 23 #include "content/public/browser/platform_notification_context.h" |
24 #include "third_party/WebKit/public/platform/modules/notifications/notification_
service.mojom.h" | 24 #include "third_party/WebKit/public/platform/modules/notifications/notification_
service.mojom.h" |
25 | 25 |
26 class GURL; | 26 class GURL; |
27 | 27 |
28 namespace base { | 28 namespace base { |
29 class SequencedTaskRunner; | 29 class SequencedTaskRunner; |
30 } | 30 } |
31 | 31 |
32 namespace service_manager { | 32 namespace service_manager { |
33 struct BindSourceInfo; | 33 struct BindSourceInfo; |
34 } | 34 } |
35 | 35 |
36 namespace content { | 36 namespace content { |
37 | 37 |
38 class BlinkNotificationServiceImpl; | 38 class BlinkNotificationServiceImpl; |
39 class BrowserContext; | 39 class BrowserContext; |
40 class NotificationDatabase; | 40 class NotificationDatabase; |
41 struct NotificationDatabaseData; | 41 struct NotificationDatabaseData; |
42 class ResourceContext; | 42 class ResourceContext; |
43 class ServiceWorkerContextWrapper; | 43 class ServiceWorkerContextWrapper; |
44 | 44 |
45 // Implementation of the Web Notification storage context. The public methods | 45 // Implementation of the Web Notification storage context. The public methods |
46 // defined in this interface must only be called on the IO thread unless | 46 // defined in this interface must only be called on the IO thread unless |
47 // otherwise specified. | 47 // otherwise specified. |
48 class CONTENT_EXPORT PlatformNotificationContextImpl | 48 class CONTENT_EXPORT PlatformNotificationContextImpl |
49 : NON_EXPORTED_BASE(public PlatformNotificationContext), | 49 : NON_EXPORTED_BASE(public PlatformNotificationContext), |
50 NON_EXPORTED_BASE(public ServiceWorkerContextObserver) { | 50 NON_EXPORTED_BASE(public ServiceWorkerContextCoreObserver) { |
51 public: | 51 public: |
52 // Constructs a new platform notification context. If |path| is non-empty, the | 52 // Constructs a new platform notification context. If |path| is non-empty, the |
53 // database will be initialized in the "Platform Notifications" subdirectory | 53 // database will be initialized in the "Platform Notifications" subdirectory |
54 // of |path|. Otherwise, the database will be initialized in memory. The | 54 // of |path|. Otherwise, the database will be initialized in memory. The |
55 // constructor must only be called on the IO thread. | 55 // constructor must only be called on the IO thread. |
56 PlatformNotificationContextImpl( | 56 PlatformNotificationContextImpl( |
57 const base::FilePath& path, | 57 const base::FilePath& path, |
58 BrowserContext* browser_context, | 58 BrowserContext* browser_context, |
59 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context); | 59 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context); |
60 | 60 |
(...skipping 27 matching lines...) Expand all Loading... |
88 const NotificationDatabaseData& database_data, | 88 const NotificationDatabaseData& database_data, |
89 const WriteResultCallback& callback) override; | 89 const WriteResultCallback& callback) override; |
90 void DeleteNotificationData(const std::string& notification_id, | 90 void DeleteNotificationData(const std::string& notification_id, |
91 const GURL& origin, | 91 const GURL& origin, |
92 const DeleteResultCallback& callback) override; | 92 const DeleteResultCallback& callback) override; |
93 void ReadAllNotificationDataForServiceWorkerRegistration( | 93 void ReadAllNotificationDataForServiceWorkerRegistration( |
94 const GURL& origin, | 94 const GURL& origin, |
95 int64_t service_worker_registration_id, | 95 int64_t service_worker_registration_id, |
96 const ReadAllResultCallback& callback) override; | 96 const ReadAllResultCallback& callback) override; |
97 | 97 |
98 // ServiceWorkerContextObserver implementation. | 98 // ServiceWorkerContextCoreObserver implementation. |
99 void OnRegistrationDeleted(int64_t registration_id, | 99 void OnRegistrationDeleted(int64_t registration_id, |
100 const GURL& pattern) override; | 100 const GURL& pattern) override; |
101 void OnStorageWiped() override; | 101 void OnStorageWiped() override; |
102 | 102 |
103 private: | 103 private: |
104 friend class PlatformNotificationContextTest; | 104 friend class PlatformNotificationContextTest; |
105 | 105 |
106 ~PlatformNotificationContextImpl() override; | 106 ~PlatformNotificationContextImpl() override; |
107 | 107 |
108 void DidGetNotificationsOnUI( | 108 void DidGetNotificationsOnUI( |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // The notification services are owned by the platform context, and will be | 213 // The notification services are owned by the platform context, and will be |
214 // removed when either this class is destroyed or the Mojo pipe disconnects. | 214 // removed when either this class is destroyed or the Mojo pipe disconnects. |
215 std::vector<std::unique_ptr<BlinkNotificationServiceImpl>> services_; | 215 std::vector<std::unique_ptr<BlinkNotificationServiceImpl>> services_; |
216 | 216 |
217 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationContextImpl); | 217 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationContextImpl); |
218 }; | 218 }; |
219 | 219 |
220 } // namespace content | 220 } // namespace content |
221 | 221 |
222 #endif // CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_ | 222 #endif // CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_ |
OLD | NEW |