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

Side by Side Diff: content/child/push_messaging/push_provider.h

Issue 793403002: Implement WebPushProvider.unregister() in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mvan_2
Patch Set: browsertests and override fix Created 6 years 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 CONTENT_CHILD_PUSH_MESSAGING_PUSH_MANAGER_H_ 5 #ifndef CONTENT_CHILD_PUSH_MESSAGING_PUSH_MANAGER_H_
6 #define CONTENT_CHILD_PUSH_MESSAGING_PUSH_MANAGER_H_ 6 #define CONTENT_CHILD_PUSH_MESSAGING_PUSH_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 15 matching lines...) Expand all
26 // The |thread_safe_sender| and |push_dispatcher| are used if calling this 26 // The |thread_safe_sender| and |push_dispatcher| are used if calling this
27 // leads to construction. 27 // leads to construction.
28 static PushProvider* ThreadSpecificInstance( 28 static PushProvider* ThreadSpecificInstance(
29 ThreadSafeSender* thread_safe_sender, 29 ThreadSafeSender* thread_safe_sender,
30 PushDispatcher* push_dispatcher); 30 PushDispatcher* push_dispatcher);
31 31
32 // WorkerTaskRunner::Observer implementation. 32 // WorkerTaskRunner::Observer implementation.
33 void OnWorkerRunLoopStopped() override; 33 void OnWorkerRunLoopStopped() override;
34 34
35 // blink::WebPushProvider implementation. 35 // blink::WebPushProvider implementation.
36 void registerPushMessaging(blink::WebServiceWorkerRegistration*, 36 virtual void registerPushMessaging(blink::WebServiceWorkerRegistration*,
37 blink::WebPushRegistrationCallbacks*) override; 37 blink::WebPushRegistrationCallbacks*);
38 void getPermissionStatus(blink::WebServiceWorkerRegistration*, 38 virtual void getPermissionStatus(blink::WebServiceWorkerRegistration*,
39 blink::WebPushPermissionStatusCallbacks*) override; 39 blink::WebPushPermissionStatusCallbacks*);
40 virtual void unregister(blink::WebServiceWorkerRegistration*,
41 blink::WebPushUnregisterCallbacks*);
40 42
41 // Called by the PushDispatcher. 43 // Called by the PushDispatcher.
42 bool OnMessageReceived(const IPC::Message& message); 44 bool OnMessageReceived(const IPC::Message& message);
43 45
44 private: 46 private:
45 PushProvider(ThreadSafeSender* thread_safe_sender, 47 PushProvider(ThreadSafeSender* thread_safe_sender,
46 PushDispatcher* push_dispatcher); 48 PushDispatcher* push_dispatcher);
47 49
48 // IPC message handlers. 50 // IPC message handlers.
49 void OnRegisterFromWorkerSuccess(int request_id, 51 void OnRegisterFromWorkerSuccess(int request_id,
50 const GURL& endpoint, 52 const GURL& endpoint,
51 const std::string& registration_id); 53 const std::string& registration_id);
52 void OnRegisterFromWorkerError(int request_id, PushRegistrationStatus status); 54 void OnRegisterFromWorkerError(int request_id, PushRegistrationStatus status);
53 void OnGetPermissionStatusSuccess(int request_id, 55 void OnGetPermissionStatusSuccess(int request_id,
54 blink::WebPushPermissionStatus status); 56 blink::WebPushPermissionStatus status);
55 void OnGetPermissionStatusError(int request_id); 57 void OnGetPermissionStatusError(int request_id);
58 void OnUnregisterResponse(int request_id, bool response);
Michael van Ouwerkerk 2014/12/12 13:55:41 nit: consider renaming |response| to something mor
mlamouri (slow - plz ping) 2014/12/15 11:29:37 Done.
56 59
57 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 60 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
58 scoped_refptr<PushDispatcher> push_dispatcher_; 61 scoped_refptr<PushDispatcher> push_dispatcher_;
59 62
60 // Stores the registration callbacks with their request ids. This class owns 63 // Stores the registration callbacks with their request ids. This class owns
61 // the callbacks. 64 // the callbacks.
62 std::map<int, blink::WebPushRegistrationCallbacks*> registration_callbacks_; 65 std::map<int, blink::WebPushRegistrationCallbacks*> registration_callbacks_;
63 66
64 // Stores the permission status callbacks with their request ids. This class 67 // Stores the permission status callbacks with their request ids. This class
65 // owns the callbacks. 68 // owns the callbacks.
66 std::map<int, blink::WebPushPermissionStatusCallbacks*> 69 std::map<int, blink::WebPushPermissionStatusCallbacks*>
67 permission_status_callbacks_; 70 permission_status_callbacks_;
68 71
72 // Stores the unregistration callbacks with their request ids. This class owns
73 // the callbacks.
74 std::map<int, blink::WebPushUnregisterCallbacks*> unregister_callbacks_;
Michael van Ouwerkerk 2014/12/12 13:55:41 Aha, leaking a whole map of raw pointers, just lik
mlamouri (slow - plz ping) 2014/12/15 11:29:37 Yeah. Right. I usually use IDMap<> and have it own
75
69 DISALLOW_COPY_AND_ASSIGN(PushProvider); 76 DISALLOW_COPY_AND_ASSIGN(PushProvider);
70 }; 77 };
71 78
72 } // namespace content 79 } // namespace content
73 80
74 #endif // CONTENT_CHILD_PUSH_MESSAGING_PUSH_MANAGER_H_ 81 #endif // CONTENT_CHILD_PUSH_MESSAGING_PUSH_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698