Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: chrome/browser/push_messaging/push_messaging_service_impl.h

Issue 2675293003: Push API: Don't wait for network when unsubscribing (Closed)
Patch Set: Address peter's review comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // KeyedService implementation. 107 // KeyedService implementation.
108 void Shutdown() override; 108 void Shutdown() override;
109 109
110 // BackgroundTrigger implementation. 110 // BackgroundTrigger implementation.
111 base::string16 GetName() override; 111 base::string16 GetName() override;
112 gfx::ImageSkia* GetIcon() override; 112 gfx::ImageSkia* GetIcon() override;
113 void OnMenuClick() override; 113 void OnMenuClick() override;
114 114
115 void SetMessageCallbackForTesting(const base::Closure& callback); 115 void SetMessageCallbackForTesting(const base::Closure& callback);
116 void SetUnsubscribeCallbackForTesting(const base::Closure& callback);
116 void SetContentSettingChangedCallbackForTesting( 117 void SetContentSettingChangedCallbackForTesting(
117 const base::Closure& callback); 118 const base::Closure& callback);
118 void SetServiceWorkerUnregisteredCallbackForTesting( 119 void SetServiceWorkerUnregisteredCallbackForTesting(
119 const base::Closure& callback); 120 const base::Closure& callback);
120 121
121 private: 122 private:
122 friend class PushMessagingBrowserTest; 123 friend class PushMessagingBrowserTest;
123 FRIEND_TEST_ALL_PREFIXES(PushMessagingServiceTest, NormalizeSenderInfo); 124 FRIEND_TEST_ALL_PREFIXES(PushMessagingServiceTest, NormalizeSenderInfo);
124 FRIEND_TEST_ALL_PREFIXES(PushMessagingServiceTest, PayloadEncryptionTest); 125 FRIEND_TEST_ALL_PREFIXES(PushMessagingServiceTest, PayloadEncryptionTest);
125 126
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 int64_t service_worker_registration_id, 186 int64_t service_worker_registration_id,
186 const std::string& app_id, 187 const std::string& app_id,
187 const std::string& sender_id, 188 const std::string& sender_id,
188 const UnregisterCallback& callback); 189 const UnregisterCallback& callback);
189 190
190 void DidClearPushSubscriptionId(content::PushUnregistrationReason reason, 191 void DidClearPushSubscriptionId(content::PushUnregistrationReason reason,
191 const std::string& app_id, 192 const std::string& app_id,
192 const std::string& sender_id, 193 const std::string& sender_id,
193 const UnregisterCallback& callback); 194 const UnregisterCallback& callback);
194 195
196 void DidUnregister(bool was_subscribed, gcm::GCMClient::Result result);
195 void DidDeleteID(const std::string& app_id, 197 void DidDeleteID(const std::string& app_id,
196 bool was_subscribed, 198 bool was_subscribed,
197 const UnregisterCallback&,
198 instance_id::InstanceID::Result result); 199 instance_id::InstanceID::Result result);
199
200 void DidUnsubscribe(const std::string& app_id_when_instance_id, 200 void DidUnsubscribe(const std::string& app_id_when_instance_id,
201 bool was_subscribed, 201 bool was_subscribed);
202 const UnregisterCallback& callback,
203 content::PushUnregistrationStatus status);
204 202
205 // OnContentSettingChanged methods ------------------------------------------- 203 // OnContentSettingChanged methods -------------------------------------------
206 204
207 void UnsubscribeBecausePermissionRevoked( 205 void UnsubscribeBecausePermissionRevoked(
208 const PushMessagingAppIdentifier& app_identifier, 206 const PushMessagingAppIdentifier& app_identifier,
209 const UnregisterCallback& callback, 207 const UnregisterCallback& callback,
210 const std::string& sender_id, 208 const std::string& sender_id,
211 bool success, 209 bool success,
212 bool not_found); 210 bool not_found);
213 211
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 const MessageDispatchedCallback& callback) { 243 const MessageDispatchedCallback& callback) {
246 message_dispatched_callback_for_testing_ = callback; 244 message_dispatched_callback_for_testing_ = callback;
247 } 245 }
248 246
249 Profile* profile_; 247 Profile* profile_;
250 248
251 int push_subscription_count_; 249 int push_subscription_count_;
252 int pending_push_subscription_count_; 250 int pending_push_subscription_count_;
253 251
254 base::Closure message_callback_for_testing_; 252 base::Closure message_callback_for_testing_;
253 base::Closure unsubscribe_callback_for_testing_;
255 base::Closure content_setting_changed_callback_for_testing_; 254 base::Closure content_setting_changed_callback_for_testing_;
256 base::Closure service_worker_unregistered_callback_for_testing_; 255 base::Closure service_worker_unregistered_callback_for_testing_;
257 256
258 PushMessagingNotificationManager notification_manager_; 257 PushMessagingNotificationManager notification_manager_;
259 258
260 // A multiset containing one entry for each in-flight push message delivery, 259 // A multiset containing one entry for each in-flight push message delivery,
261 // keyed by the receiver's app id. 260 // keyed by the receiver's app id.
262 std::multiset<std::string> in_flight_message_deliveries_; 261 std::multiset<std::string> in_flight_message_deliveries_;
263 262
264 MessageDispatchedCallback message_dispatched_callback_for_testing_; 263 MessageDispatchedCallback message_dispatched_callback_for_testing_;
265 264
266 std::unique_ptr<PushMessagingServiceObserver> 265 std::unique_ptr<PushMessagingServiceObserver>
267 push_messaging_service_observer_; 266 push_messaging_service_observer_;
268 267
269 #if BUILDFLAG(ENABLE_BACKGROUND) 268 #if BUILDFLAG(ENABLE_BACKGROUND)
270 // KeepAlive registered while we have in-flight push messages, to make sure 269 // KeepAlive registered while we have in-flight push messages, to make sure
271 // we can finish processing them without being interrupted. 270 // we can finish processing them without being interrupted.
272 std::unique_ptr<ScopedKeepAlive> in_flight_keep_alive_; 271 std::unique_ptr<ScopedKeepAlive> in_flight_keep_alive_;
273 #endif 272 #endif
274 273
275 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; 274 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_;
276 275
277 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); 276 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl);
278 }; 277 };
279 278
280 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ 279 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698