| 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/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.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 "components/content_settings/core/browser/content_settings_observer.h" | 19 #include "components/content_settings/core/browser/content_settings_observer.h" |
| 20 #include "components/content_settings/core/common/content_settings.h" | 20 #include "components/content_settings/core/common/content_settings.h" |
| 21 #include "components/gcm_driver/common/gcm_messages.h" | 21 #include "components/gcm_driver/common/gcm_messages.h" |
| 22 #include "components/gcm_driver/gcm_app_handler.h" | 22 #include "components/gcm_driver/gcm_app_handler.h" |
| 23 #include "components/gcm_driver/gcm_client.h" | 23 #include "components/gcm_driver/gcm_client.h" |
| 24 #include "components/keyed_service/core/keyed_service.h" | 24 #include "components/keyed_service/core/keyed_service.h" |
| 25 #include "content/public/browser/push_messaging_service.h" | 25 #include "content/public/browser/push_messaging_service.h" |
| 26 #include "content/public/common/permission_status.mojom.h" | 26 #include "content/public/common/permission_status.mojom.h" |
| 27 #include "content/public/common/push_event_payload.h" |
| 27 #include "content/public/common/push_messaging_status.h" | 28 #include "content/public/common/push_messaging_status.h" |
| 28 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi
ssionStatus.h" | 29 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi
ssionStatus.h" |
| 29 | 30 |
| 30 #if defined(ENABLE_NOTIFICATIONS) | 31 #if defined(ENABLE_NOTIFICATIONS) |
| 31 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h" | 32 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h" |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 class Profile; | 35 class Profile; |
| 35 class PushMessagingAppIdentifier; | 36 class PushMessagingAppIdentifier; |
| 36 class PushMessagingServiceObserver; | 37 class PushMessagingServiceObserver; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 gcm::GCMDriver* GetGCMDriver() const; | 207 gcm::GCMDriver* GetGCMDriver() const; |
| 207 | 208 |
| 208 // Testing methods ----------------------------------------------------------- | 209 // Testing methods ----------------------------------------------------------- |
| 209 | 210 |
| 210 // Callback to be invoked when a message has been dispatched. Enables tests to | 211 // Callback to be invoked when a message has been dispatched. Enables tests to |
| 211 // observe message delivery before it's dispatched to the Service Worker. | 212 // observe message delivery before it's dispatched to the Service Worker. |
| 212 using MessageDispatchedCallback = | 213 using MessageDispatchedCallback = |
| 213 base::Callback<void(const std::string& app_id, | 214 base::Callback<void(const std::string& app_id, |
| 214 const GURL& origin, | 215 const GURL& origin, |
| 215 int64_t service_worker_registration_id, | 216 int64_t service_worker_registration_id, |
| 216 const std::string& message_data)>; | 217 const content::PushEventPayload& payload)>; |
| 217 | 218 |
| 218 void SetMessageDispatchedCallbackForTesting( | 219 void SetMessageDispatchedCallbackForTesting( |
| 219 const MessageDispatchedCallback& callback) { | 220 const MessageDispatchedCallback& callback) { |
| 220 message_dispatched_callback_for_testing_ = callback; | 221 message_dispatched_callback_for_testing_ = callback; |
| 221 } | 222 } |
| 222 | 223 |
| 223 Profile* profile_; | 224 Profile* profile_; |
| 224 | 225 |
| 225 int push_subscription_count_; | 226 int push_subscription_count_; |
| 226 int pending_push_subscription_count_; | 227 int pending_push_subscription_count_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 239 MessageDispatchedCallback message_dispatched_callback_for_testing_; | 240 MessageDispatchedCallback message_dispatched_callback_for_testing_; |
| 240 | 241 |
| 241 scoped_ptr<PushMessagingServiceObserver> push_messaging_service_observer_; | 242 scoped_ptr<PushMessagingServiceObserver> push_messaging_service_observer_; |
| 242 | 243 |
| 243 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 244 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
| 244 | 245 |
| 245 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 246 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
| 246 }; | 247 }; |
| 247 | 248 |
| 248 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 249 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
| OLD | NEW |