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