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 <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "chrome/browser/background/background_trigger.h" | 18 #include "chrome/browser/background/background_trigger.h" |
| 19 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h" |
19 #include "chrome/common/features.h" | 20 #include "chrome/common/features.h" |
20 #include "components/content_settings/core/browser/content_settings_observer.h" | 21 #include "components/content_settings/core/browser/content_settings_observer.h" |
21 #include "components/content_settings/core/common/content_settings.h" | 22 #include "components/content_settings/core/common/content_settings.h" |
22 #include "components/gcm_driver/common/gcm_messages.h" | 23 #include "components/gcm_driver/common/gcm_messages.h" |
23 #include "components/gcm_driver/gcm_app_handler.h" | 24 #include "components/gcm_driver/gcm_app_handler.h" |
24 #include "components/gcm_driver/gcm_client.h" | 25 #include "components/gcm_driver/gcm_client.h" |
25 #include "components/gcm_driver/instance_id/instance_id.h" | 26 #include "components/gcm_driver/instance_id/instance_id.h" |
26 #include "components/keyed_service/core/keyed_service.h" | 27 #include "components/keyed_service/core/keyed_service.h" |
27 #include "content/public/browser/push_messaging_service.h" | 28 #include "content/public/browser/push_messaging_service.h" |
28 #include "content/public/common/push_event_payload.h" | 29 #include "content/public/common/push_event_payload.h" |
29 #include "content/public/common/push_messaging_status.h" | 30 #include "content/public/common/push_messaging_status.h" |
30 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom.h" | 31 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom.h" |
31 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi
ssionStatus.h" | 32 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi
ssionStatus.h" |
32 | 33 |
33 #if defined(ENABLE_NOTIFICATIONS) | |
34 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h" | |
35 #endif | |
36 | |
37 class Profile; | 34 class Profile; |
38 class PushMessagingAppIdentifier; | 35 class PushMessagingAppIdentifier; |
39 class PushMessagingServiceObserver; | 36 class PushMessagingServiceObserver; |
40 class PushMessagingServiceTest; | 37 class PushMessagingServiceTest; |
41 class ScopedKeepAlive; | 38 class ScopedKeepAlive; |
42 struct PushSubscriptionOptions; | 39 struct PushSubscriptionOptions; |
43 | 40 |
44 namespace gcm { | 41 namespace gcm { |
45 class GCMDriver; | 42 class GCMDriver; |
46 } | 43 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 242 } |
246 | 243 |
247 Profile* profile_; | 244 Profile* profile_; |
248 | 245 |
249 int push_subscription_count_; | 246 int push_subscription_count_; |
250 int pending_push_subscription_count_; | 247 int pending_push_subscription_count_; |
251 | 248 |
252 base::Closure message_callback_for_testing_; | 249 base::Closure message_callback_for_testing_; |
253 base::Closure content_setting_changed_callback_for_testing_; | 250 base::Closure content_setting_changed_callback_for_testing_; |
254 | 251 |
255 #if defined(ENABLE_NOTIFICATIONS) | |
256 PushMessagingNotificationManager notification_manager_; | 252 PushMessagingNotificationManager notification_manager_; |
257 #endif | |
258 | 253 |
259 // A multiset containing one entry for each in-flight push message delivery, | 254 // A multiset containing one entry for each in-flight push message delivery, |
260 // keyed by the receiver's app id. | 255 // keyed by the receiver's app id. |
261 std::multiset<std::string> in_flight_message_deliveries_; | 256 std::multiset<std::string> in_flight_message_deliveries_; |
262 | 257 |
263 MessageDispatchedCallback message_dispatched_callback_for_testing_; | 258 MessageDispatchedCallback message_dispatched_callback_for_testing_; |
264 | 259 |
265 std::unique_ptr<PushMessagingServiceObserver> | 260 std::unique_ptr<PushMessagingServiceObserver> |
266 push_messaging_service_observer_; | 261 push_messaging_service_observer_; |
267 | 262 |
268 #if BUILDFLAG(ENABLE_BACKGROUND) | 263 #if BUILDFLAG(ENABLE_BACKGROUND) |
269 // KeepAlive registered while we have in-flight push messages, to make sure | 264 // KeepAlive registered while we have in-flight push messages, to make sure |
270 // we can finish processing them without being interrupted. | 265 // we can finish processing them without being interrupted. |
271 std::unique_ptr<ScopedKeepAlive> in_flight_keep_alive_; | 266 std::unique_ptr<ScopedKeepAlive> in_flight_keep_alive_; |
272 #endif | 267 #endif |
273 | 268 |
274 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 269 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
275 | 270 |
276 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 271 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
277 }; | 272 }; |
278 | 273 |
279 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 274 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
OLD | NEW |