| 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> |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 void SubscribeEndWithError( | 136 void SubscribeEndWithError( |
| 137 const content::PushMessagingService::RegisterCallback& callback, | 137 const content::PushMessagingService::RegisterCallback& callback, |
| 138 content::PushRegistrationStatus status); | 138 content::PushRegistrationStatus status); |
| 139 | 139 |
| 140 void DidSubscribe( | 140 void DidSubscribe( |
| 141 const PushMessagingAppIdentifier& app_identifier, | 141 const PushMessagingAppIdentifier& app_identifier, |
| 142 const content::PushMessagingService::RegisterCallback& callback, | 142 const content::PushMessagingService::RegisterCallback& callback, |
| 143 const std::string& subscription_id, | 143 const std::string& subscription_id, |
| 144 gcm::GCMClient::Result result); | 144 gcm::GCMClient::Result result); |
| 145 | 145 |
| 146 void DidSubscribeWithPublicKey( |
| 147 const PushMessagingAppIdentifier& app_identifier, |
| 148 const content::PushMessagingService::RegisterCallback& callback, |
| 149 const std::string& subscription_id, |
| 150 const std::string& public_key); |
| 151 |
| 146 void DidRequestPermission( | 152 void DidRequestPermission( |
| 147 const PushMessagingAppIdentifier& app_identifier, | 153 const PushMessagingAppIdentifier& app_identifier, |
| 148 const std::string& sender_id, | 154 const std::string& sender_id, |
| 149 const content::PushMessagingService::RegisterCallback& callback, | 155 const content::PushMessagingService::RegisterCallback& callback, |
| 150 content::PermissionStatus permission_status); | 156 content::PermissionStatus permission_status); |
| 151 | 157 |
| 158 // GetPublicEncryptionKey method --------------------------------------------- |
| 159 |
| 160 void DidGetPublicKey( |
| 161 const PushMessagingService::PublicKeyCallback& callback, |
| 162 const std::string& public_key) const; |
| 163 |
| 164 |
| 152 // Unsubscribe methods ------------------------------------------------------- | 165 // Unsubscribe methods ------------------------------------------------------- |
| 153 | 166 |
| 154 void Unsubscribe(const std::string& app_id, | 167 void Unsubscribe(const std::string& app_id, |
| 155 const std::string& sender_id, | 168 const std::string& sender_id, |
| 156 const content::PushMessagingService::UnregisterCallback&); | 169 const content::PushMessagingService::UnregisterCallback&); |
| 157 | 170 |
| 158 void DidUnsubscribe(bool was_subscribed, | 171 void DidUnsubscribe(bool was_subscribed, |
| 159 const content::PushMessagingService::UnregisterCallback&, | 172 const content::PushMessagingService::UnregisterCallback&, |
| 160 gcm::GCMClient::Result result); | 173 gcm::GCMClient::Result result); |
| 161 | 174 |
| 162 // OnContentSettingChanged methods ------------------------------------------- | 175 // OnContentSettingChanged methods ------------------------------------------- |
| 163 | 176 |
| 164 void UnsubscribeBecausePermissionRevoked( | 177 void UnsubscribeBecausePermissionRevoked( |
| 165 const PushMessagingAppIdentifier& app_identifier, | 178 const PushMessagingAppIdentifier& app_identifier, |
| 166 const base::Closure& closure, | 179 const base::Closure& closure, |
| 167 const std::string& sender_id, | 180 const std::string& sender_id, |
| 168 bool success, | 181 bool success, |
| 169 bool not_found); | 182 bool not_found); |
| 170 | 183 |
| 171 // Helper methods ------------------------------------------------------------ | 184 // Helper methods ------------------------------------------------------------ |
| 172 | 185 |
| 173 // Checks if a given origin is allowed to use Push. | 186 // Checks if a given origin is allowed to use Push. |
| 174 bool IsPermissionSet(const GURL& origin); | 187 bool IsPermissionSet(const GURL& origin); |
| 175 | 188 |
| 189 // Returns whether incoming messages should support payloads. |
| 190 bool AreMessagePayloadsEnabled() const; |
| 191 |
| 176 gcm::GCMDriver* GetGCMDriver() const; | 192 gcm::GCMDriver* GetGCMDriver() const; |
| 177 | 193 |
| 178 Profile* profile_; | 194 Profile* profile_; |
| 179 | 195 |
| 180 int push_subscription_count_; | 196 int push_subscription_count_; |
| 181 int pending_push_subscription_count_; | 197 int pending_push_subscription_count_; |
| 182 | 198 |
| 183 base::Closure message_callback_for_testing_; | 199 base::Closure message_callback_for_testing_; |
| 184 base::Closure content_setting_changed_callback_for_testing_; | 200 base::Closure content_setting_changed_callback_for_testing_; |
| 185 | 201 |
| 186 #if defined(ENABLE_NOTIFICATIONS) | 202 #if defined(ENABLE_NOTIFICATIONS) |
| 187 PushMessagingNotificationManager notification_manager_; | 203 PushMessagingNotificationManager notification_manager_; |
| 188 #endif | 204 #endif |
| 189 | 205 |
| 190 // A multiset containing one entry for each in-flight push message delivery, | 206 // A multiset containing one entry for each in-flight push message delivery, |
| 191 // keyed by the receiver's app id. | 207 // keyed by the receiver's app id. |
| 192 std::multiset<std::string> in_flight_message_deliveries_; | 208 std::multiset<std::string> in_flight_message_deliveries_; |
| 193 | 209 |
| 194 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 210 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
| 195 | 211 |
| 196 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 212 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
| 197 }; | 213 }; |
| 198 | 214 |
| 199 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 215 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
| OLD | NEW |