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 CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/scoped_ptr.h" | |
15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
16 #include "chrome/browser/background/background_trigger.h" | 17 #include "chrome/browser/background/background_trigger.h" |
17 #include "components/content_settings/core/browser/content_settings_observer.h" | 18 #include "components/content_settings/core/browser/content_settings_observer.h" |
18 #include "components/content_settings/core/common/content_settings.h" | 19 #include "components/content_settings/core/common/content_settings.h" |
19 #include "components/gcm_driver/common/gcm_messages.h" | 20 #include "components/gcm_driver/common/gcm_messages.h" |
20 #include "components/gcm_driver/gcm_app_handler.h" | 21 #include "components/gcm_driver/gcm_app_handler.h" |
21 #include "components/gcm_driver/gcm_client.h" | 22 #include "components/gcm_driver/gcm_client.h" |
22 #include "components/keyed_service/core/keyed_service.h" | 23 #include "components/keyed_service/core/keyed_service.h" |
23 #include "content/public/browser/push_messaging_service.h" | 24 #include "content/public/browser/push_messaging_service.h" |
24 #include "content/public/common/permission_status.mojom.h" | 25 #include "content/public/common/permission_status.mojom.h" |
25 #include "content/public/common/push_messaging_status.h" | 26 #include "content/public/common/push_messaging_status.h" |
26 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi ssionStatus.h" | 27 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi ssionStatus.h" |
27 | 28 |
28 #if defined(ENABLE_NOTIFICATIONS) | 29 #if defined(ENABLE_NOTIFICATIONS) |
29 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h" | 30 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h" |
30 #endif | 31 #endif |
31 | 32 |
32 class Profile; | 33 class Profile; |
33 class PushMessagingAppIdentifier; | 34 class PushMessagingAppIdentifier; |
35 class PushMessagingServiceObserver; | |
34 | 36 |
35 namespace gcm { | 37 namespace gcm { |
36 class GCMDriver; | 38 class GCMDriver; |
37 class GCMProfileService; | 39 class GCMProfileService; |
38 } | 40 } |
39 | 41 |
40 namespace user_prefs { | 42 namespace user_prefs { |
41 class PrefRegistrySyncable; | 43 class PrefRegistrySyncable; |
42 } | 44 } |
43 | 45 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 | 126 |
125 // OnMessage methods --------------------------------------------------------- | 127 // OnMessage methods --------------------------------------------------------- |
126 | 128 |
127 void DeliverMessageCallback(const std::string& app_id, | 129 void DeliverMessageCallback(const std::string& app_id, |
128 const GURL& requesting_origin, | 130 const GURL& requesting_origin, |
129 int64 service_worker_registration_id, | 131 int64 service_worker_registration_id, |
130 const gcm::IncomingMessage& message, | 132 const gcm::IncomingMessage& message, |
131 const base::Closure& message_handled_closure, | 133 const base::Closure& message_handled_closure, |
132 content::PushDeliveryStatus status); | 134 content::PushDeliveryStatus status); |
133 | 135 |
136 void OnMessageHandled(const std::string& app_id, | |
Peter Beverloo
2015/12/10 18:47:51
nit: DidHandleMessage for consistency with the oth
Michael van Ouwerkerk
2015/12/11 11:23:54
Done.
| |
137 const base::Closure& completion_closure); | |
138 | |
134 // Subscribe methods --------------------------------------------------------- | 139 // Subscribe methods --------------------------------------------------------- |
135 | 140 |
136 void SubscribeEnd( | 141 void SubscribeEnd( |
137 const content::PushMessagingService::RegisterCallback& callback, | 142 const content::PushMessagingService::RegisterCallback& callback, |
138 const std::string& subscription_id, | 143 const std::string& subscription_id, |
139 const std::vector<uint8_t>& p256dh, | 144 const std::vector<uint8_t>& p256dh, |
140 const std::vector<uint8_t>& auth, | 145 const std::vector<uint8_t>& auth, |
141 content::PushRegistrationStatus status); | 146 content::PushRegistrationStatus status); |
142 | 147 |
143 void SubscribeEndWithError( | 148 void SubscribeEndWithError( |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 #if defined(ENABLE_NOTIFICATIONS) | 229 #if defined(ENABLE_NOTIFICATIONS) |
225 PushMessagingNotificationManager notification_manager_; | 230 PushMessagingNotificationManager notification_manager_; |
226 #endif | 231 #endif |
227 | 232 |
228 // A multiset containing one entry for each in-flight push message delivery, | 233 // A multiset containing one entry for each in-flight push message delivery, |
229 // keyed by the receiver's app id. | 234 // keyed by the receiver's app id. |
230 std::multiset<std::string> in_flight_message_deliveries_; | 235 std::multiset<std::string> in_flight_message_deliveries_; |
231 | 236 |
232 MessageDispatchedCallback message_dispatched_callback_for_testing_; | 237 MessageDispatchedCallback message_dispatched_callback_for_testing_; |
233 | 238 |
239 scoped_ptr<PushMessagingServiceObserver> push_messaging_service_observer_; | |
240 | |
234 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 241 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
235 | 242 |
236 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 243 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
237 }; | 244 }; |
238 | 245 |
239 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 246 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
OLD | NEW |