OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ |
6 #define CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ | 6 #define CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "content/common/push_messaging.mojom.h" | 16 #include "content/common/push_messaging.mojom.h" |
17 #include "content/common/service_worker/service_worker_status_code.h" | 17 #include "content/common/service_worker/service_worker_status_code.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/common/push_messaging_status.h" | 19 #include "content/public/common/push_messaging_status.h" |
20 #include "mojo/public/cpp/bindings/binding_set.h" | 20 #include "mojo/public/cpp/bindings/binding_set.h" |
21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
22 | 22 |
| 23 namespace service_manager { |
| 24 struct BindSourceInfo; |
| 25 } |
| 26 |
23 namespace content { | 27 namespace content { |
24 | 28 |
25 class PushMessagingService; | 29 class PushMessagingService; |
26 class ServiceWorkerContextWrapper; | 30 class ServiceWorkerContextWrapper; |
27 struct PushSubscriptionOptions; | 31 struct PushSubscriptionOptions; |
28 | 32 |
29 // Documented at definition. | 33 // Documented at definition. |
30 extern const char kPushSenderIdServiceWorkerKey[]; | 34 extern const char kPushSenderIdServiceWorkerKey[]; |
31 extern const char kPushRegistrationIdServiceWorkerKey[]; | 35 extern const char kPushRegistrationIdServiceWorkerKey[]; |
32 | 36 |
33 class PushMessagingManager : public mojom::PushMessaging { | 37 class PushMessagingManager : public mojom::PushMessaging { |
34 public: | 38 public: |
35 PushMessagingManager(int render_process_id, | 39 PushMessagingManager(int render_process_id, |
36 ServiceWorkerContextWrapper* service_worker_context); | 40 ServiceWorkerContextWrapper* service_worker_context); |
37 | 41 |
38 void BindRequest(mojom::PushMessagingRequest request); | 42 void BindRequest(const service_manager::BindSourceInfo& source_info, |
| 43 mojom::PushMessagingRequest request); |
39 | 44 |
40 // mojom::PushMessaging impl, run on IO thread. | 45 // mojom::PushMessaging impl, run on IO thread. |
41 void Subscribe(int32_t render_frame_id, | 46 void Subscribe(int32_t render_frame_id, |
42 int64_t service_worker_registration_id, | 47 int64_t service_worker_registration_id, |
43 const PushSubscriptionOptions& options, | 48 const PushSubscriptionOptions& options, |
44 SubscribeCallback callback) override; | 49 SubscribeCallback callback) override; |
45 void Unsubscribe(int64_t service_worker_registration_id, | 50 void Unsubscribe(int64_t service_worker_registration_id, |
46 UnsubscribeCallback callback) override; | 51 UnsubscribeCallback callback) override; |
47 void GetSubscription(int64_t service_worker_registration_id, | 52 void GetSubscription(int64_t service_worker_registration_id, |
48 GetSubscriptionCallback callback) override; | 53 GetSubscriptionCallback callback) override; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 mojo::BindingSet<mojom::PushMessaging> bindings_; | 138 mojo::BindingSet<mojom::PushMessaging> bindings_; |
134 | 139 |
135 base::WeakPtrFactory<PushMessagingManager> weak_factory_io_to_io_; | 140 base::WeakPtrFactory<PushMessagingManager> weak_factory_io_to_io_; |
136 | 141 |
137 DISALLOW_COPY_AND_ASSIGN(PushMessagingManager); | 142 DISALLOW_COPY_AND_ASSIGN(PushMessagingManager); |
138 }; | 143 }; |
139 | 144 |
140 } // namespace content | 145 } // namespace content |
141 | 146 |
142 #endif // CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ | 147 #endif // CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MANAGER_H_ |
OLD | NEW |