| 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_PROVIDER_H_ | 5 #ifndef CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ |
| 6 #define CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ | 6 #define CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 8 #include <string> | 9 #include <string> |
| 10 #include <vector> |
| 9 | 11 |
| 10 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "content/child/push_messaging/push_dispatcher.h" | 14 #include "content/child/push_messaging/push_dispatcher.h" |
| 13 #include "content/child/worker_task_runner.h" | 15 #include "content/child/worker_task_runner.h" |
| 14 #include "content/public/common/push_messaging_status.h" | 16 #include "content/public/common/push_messaging_status.h" |
| 15 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushError
.h" | 17 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushError
.h" |
| 16 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushProvi
der.h" | 18 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushProvi
der.h" |
| 17 | 19 |
| 18 class GURL; | 20 class GURL; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 59 |
| 58 // Called by the PushDispatcher. | 60 // Called by the PushDispatcher. |
| 59 bool OnMessageReceived(const IPC::Message& message); | 61 bool OnMessageReceived(const IPC::Message& message); |
| 60 | 62 |
| 61 private: | 63 private: |
| 62 PushProvider(ThreadSafeSender* thread_safe_sender, | 64 PushProvider(ThreadSafeSender* thread_safe_sender, |
| 63 PushDispatcher* push_dispatcher); | 65 PushDispatcher* push_dispatcher); |
| 64 | 66 |
| 65 // IPC message handlers. | 67 // IPC message handlers. |
| 66 void OnSubscribeFromWorkerSuccess(int request_id, | 68 void OnSubscribeFromWorkerSuccess(int request_id, |
| 67 const GURL& endpoint); | 69 const GURL& endpoint, |
| 70 const std::vector<uint8_t>& curve25519dh); |
| 68 void OnSubscribeFromWorkerError(int request_id, | 71 void OnSubscribeFromWorkerError(int request_id, |
| 69 PushRegistrationStatus status); | 72 PushRegistrationStatus status); |
| 70 void OnUnsubscribeSuccess(int request_id, bool did_unsubscribe); | 73 void OnUnsubscribeSuccess(int request_id, bool did_unsubscribe); |
| 71 void OnUnsubscribeError(int request_id, | 74 void OnUnsubscribeError(int request_id, |
| 72 blink::WebPushError::ErrorType error_type, | 75 blink::WebPushError::ErrorType error_type, |
| 73 const std::string& error_message); | 76 const std::string& error_message); |
| 74 void OnGetRegistrationSuccess(int request_id, | 77 void OnGetRegistrationSuccess(int request_id, |
| 75 const GURL& endpoint); | 78 const GURL& endpoint, |
| 79 const std::vector<uint8_t>& curve25519dh); |
| 76 void OnGetRegistrationError(int request_id, PushGetRegistrationStatus status); | 80 void OnGetRegistrationError(int request_id, PushGetRegistrationStatus status); |
| 77 void OnGetPermissionStatusSuccess(int request_id, | 81 void OnGetPermissionStatusSuccess(int request_id, |
| 78 blink::WebPushPermissionStatus status); | 82 blink::WebPushPermissionStatus status); |
| 79 void OnGetPermissionStatusError(int request_id, | 83 void OnGetPermissionStatusError(int request_id, |
| 80 blink::WebPushError::ErrorType error); | 84 blink::WebPushError::ErrorType error); |
| 81 | 85 |
| 82 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 86 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 83 scoped_refptr<PushDispatcher> push_dispatcher_; | 87 scoped_refptr<PushDispatcher> push_dispatcher_; |
| 84 | 88 |
| 85 // Stores the subscription callbacks with their request ids. This class owns | 89 // Stores the subscription callbacks with their request ids. This class owns |
| (...skipping 10 matching lines...) Expand all Loading... |
| 96 // the callbacks. | 100 // the callbacks. |
| 97 IDMap<blink::WebPushUnsubscribeCallbacks, IDMapOwnPointer> | 101 IDMap<blink::WebPushUnsubscribeCallbacks, IDMapOwnPointer> |
| 98 unsubscribe_callbacks_; | 102 unsubscribe_callbacks_; |
| 99 | 103 |
| 100 DISALLOW_COPY_AND_ASSIGN(PushProvider); | 104 DISALLOW_COPY_AND_ASSIGN(PushProvider); |
| 101 }; | 105 }; |
| 102 | 106 |
| 103 } // namespace content | 107 } // namespace content |
| 104 | 108 |
| 105 #endif // CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ | 109 #endif // CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ |
| OLD | NEW |