Chromium Code Reviews| 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_event_payload.h" |
| 28 #include "content/public/common/push_messaging_status.h" | 28 #include "content/public/common/push_messaging_status.h" |
| 29 #include "content/public/common/push_subscription_options.h" | |
|
Peter Beverloo
2016/02/26 16:02:33
micro nit: could forward declare this
harkness
2016/02/26 17:12:04
Done.
| |
| 29 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi ssionStatus.h" | 30 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushPermi ssionStatus.h" |
| 30 | 31 |
| 31 #if defined(ENABLE_NOTIFICATIONS) | 32 #if defined(ENABLE_NOTIFICATIONS) |
| 32 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h" | 33 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h" |
| 33 #endif | 34 #endif |
| 34 | 35 |
| 35 class Profile; | 36 class Profile; |
| 36 class PushMessagingAppIdentifier; | 37 class PushMessagingAppIdentifier; |
| 37 class PushMessagingServiceObserver; | 38 class PushMessagingServiceObserver; |
| 38 | 39 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 67 const gcm::GCMClient::SendErrorDetails& send_error_details) override; | 68 const gcm::GCMClient::SendErrorDetails& send_error_details) override; |
| 68 void OnSendAcknowledged(const std::string& app_id, | 69 void OnSendAcknowledged(const std::string& app_id, |
| 69 const std::string& message_id) override; | 70 const std::string& message_id) override; |
| 70 bool CanHandle(const std::string& app_id) const override; | 71 bool CanHandle(const std::string& app_id) const override; |
| 71 | 72 |
| 72 // content::PushMessagingService implementation: | 73 // content::PushMessagingService implementation: |
| 73 GURL GetPushEndpoint() override; | 74 GURL GetPushEndpoint() override; |
| 74 void SubscribeFromDocument( | 75 void SubscribeFromDocument( |
| 75 const GURL& requesting_origin, | 76 const GURL& requesting_origin, |
| 76 int64_t service_worker_registration_id, | 77 int64_t service_worker_registration_id, |
| 77 const std::string& sender_id, | |
| 78 int renderer_id, | 78 int renderer_id, |
| 79 int render_frame_id, | 79 int render_frame_id, |
| 80 bool user_visible, | 80 const content::PushSubscriptionOptions& options, |
| 81 const content::PushMessagingService::RegisterCallback& callback) override; | 81 const content::PushMessagingService::RegisterCallback& callback) override; |
| 82 void SubscribeFromWorker( | 82 void SubscribeFromWorker( |
| 83 const GURL& requesting_origin, | 83 const GURL& requesting_origin, |
| 84 int64_t service_worker_registration_id, | 84 int64_t service_worker_registration_id, |
| 85 const std::string& sender_id, | 85 const content::PushSubscriptionOptions& options, |
| 86 bool user_visible, | |
| 87 const content::PushMessagingService::RegisterCallback& callback) override; | 86 const content::PushMessagingService::RegisterCallback& callback) override; |
| 88 void GetEncryptionInfo( | 87 void GetEncryptionInfo( |
| 89 const GURL& origin, | 88 const GURL& origin, |
| 90 int64_t service_worker_registration_id, | 89 int64_t service_worker_registration_id, |
| 91 const content::PushMessagingService::EncryptionInfoCallback& callback) | 90 const content::PushMessagingService::EncryptionInfoCallback& callback) |
| 92 override; | 91 override; |
| 93 void Unsubscribe( | 92 void Unsubscribe( |
| 94 const GURL& requesting_origin, | 93 const GURL& requesting_origin, |
| 95 int64_t service_worker_registration_id, | 94 int64_t service_worker_registration_id, |
| 96 const std::string& sender_id, | 95 const std::string& sender_id, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 | 157 |
| 159 void DidSubscribeWithEncryptionInfo( | 158 void DidSubscribeWithEncryptionInfo( |
| 160 const PushMessagingAppIdentifier& app_identifier, | 159 const PushMessagingAppIdentifier& app_identifier, |
| 161 const content::PushMessagingService::RegisterCallback& callback, | 160 const content::PushMessagingService::RegisterCallback& callback, |
| 162 const std::string& subscription_id, | 161 const std::string& subscription_id, |
| 163 const std::string& p256dh, | 162 const std::string& p256dh, |
| 164 const std::string& auth_secret); | 163 const std::string& auth_secret); |
| 165 | 164 |
| 166 void DidRequestPermission( | 165 void DidRequestPermission( |
| 167 const PushMessagingAppIdentifier& app_identifier, | 166 const PushMessagingAppIdentifier& app_identifier, |
| 168 const std::string& sender_id, | 167 const content::PushSubscriptionOptions& options, |
| 169 const content::PushMessagingService::RegisterCallback& callback, | 168 const content::PushMessagingService::RegisterCallback& callback, |
| 170 content::PermissionStatus permission_status); | 169 content::PermissionStatus permission_status); |
| 171 | 170 |
| 172 // GetEncryptionInfo method -------------------------------------------------- | 171 // GetEncryptionInfo method -------------------------------------------------- |
| 173 | 172 |
| 174 void DidGetEncryptionInfo( | 173 void DidGetEncryptionInfo( |
| 175 const PushMessagingService::EncryptionInfoCallback& callback, | 174 const PushMessagingService::EncryptionInfoCallback& callback, |
| 176 const std::string& p256dh, | 175 const std::string& p256dh, |
| 177 const std::string& auth_secret) const; | 176 const std::string& auth_secret) const; |
| 178 | 177 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 MessageDispatchedCallback message_dispatched_callback_for_testing_; | 235 MessageDispatchedCallback message_dispatched_callback_for_testing_; |
| 237 | 236 |
| 238 scoped_ptr<PushMessagingServiceObserver> push_messaging_service_observer_; | 237 scoped_ptr<PushMessagingServiceObserver> push_messaging_service_observer_; |
| 239 | 238 |
| 240 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 239 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
| 241 | 240 |
| 242 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 241 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
| 243 }; | 242 }; |
| 244 | 243 |
| 245 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 244 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
| OLD | NEW |