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 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 Loading... | |
| 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*, | |
|
johnme
2014/12/15 12:07:16
Ditto method order. And below.
| |
| 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 unregistered); | |
|
Michael van Ouwerkerk
2014/12/15 12:29:14
I'd like more clarity on the meaning of this boole
Michael van Ouwerkerk
2014/12/16 11:36:51
From [1] it seems your intent is to signal whether
| |
| 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_; | |
| 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_ |
| OLD | NEW |