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 | 11 |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
14 #include "components/content_settings/core/browser/content_settings_observer.h" | 15 #include "components/content_settings/core/browser/content_settings_observer.h" |
15 #include "components/content_settings/core/common/content_settings.h" | 16 #include "components/content_settings/core/common/content_settings.h" |
16 #include "components/gcm_driver/common/gcm_messages.h" | 17 #include "components/gcm_driver/common/gcm_messages.h" |
17 #include "components/gcm_driver/gcm_app_handler.h" | 18 #include "components/gcm_driver/gcm_app_handler.h" |
18 #include "components/gcm_driver/gcm_client.h" | 19 #include "components/gcm_driver/gcm_client.h" |
19 #include "components/keyed_service/core/keyed_service.h" | 20 #include "components/keyed_service/core/keyed_service.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 const std::string& app_id, | 62 const std::string& app_id, |
62 const gcm::GCMClient::SendErrorDetails& send_error_details) override; | 63 const gcm::GCMClient::SendErrorDetails& send_error_details) override; |
63 void OnSendAcknowledged(const std::string& app_id, | 64 void OnSendAcknowledged(const std::string& app_id, |
64 const std::string& message_id) override; | 65 const std::string& message_id) override; |
65 bool CanHandle(const std::string& app_id) const override; | 66 bool CanHandle(const std::string& app_id) const override; |
66 | 67 |
67 // content::PushMessagingService implementation: | 68 // content::PushMessagingService implementation: |
68 GURL GetPushEndpoint() override; | 69 GURL GetPushEndpoint() override; |
69 void SubscribeFromDocument( | 70 void SubscribeFromDocument( |
70 const GURL& requesting_origin, | 71 const GURL& requesting_origin, |
71 int64 service_worker_registration_id, | 72 int64_t service_worker_registration_id, |
72 const std::string& sender_id, | 73 const std::string& sender_id, |
73 int renderer_id, | 74 int renderer_id, |
74 int render_frame_id, | 75 int render_frame_id, |
75 bool user_visible, | 76 bool user_visible, |
76 const content::PushMessagingService::RegisterCallback& callback) override; | 77 const content::PushMessagingService::RegisterCallback& callback) override; |
77 void SubscribeFromWorker( | 78 void SubscribeFromWorker( |
78 const GURL& requesting_origin, | 79 const GURL& requesting_origin, |
79 int64 service_worker_registration_id, | 80 int64_t service_worker_registration_id, |
80 const std::string& sender_id, | 81 const std::string& sender_id, |
81 bool user_visible, | 82 bool user_visible, |
82 const content::PushMessagingService::RegisterCallback& callback) override; | 83 const content::PushMessagingService::RegisterCallback& callback) override; |
| 84 void GetPublicEncryptionKey( |
| 85 const GURL& origin, |
| 86 int64_t service_worker_registration_id, |
| 87 const content::PushMessagingService::PublicKeyCallback& |
| 88 callback) override; |
83 void Unsubscribe( | 89 void Unsubscribe( |
84 const GURL& requesting_origin, | 90 const GURL& requesting_origin, |
85 int64 service_worker_registration_id, | 91 int64_t service_worker_registration_id, |
86 const std::string& sender_id, | 92 const std::string& sender_id, |
87 const content::PushMessagingService::UnregisterCallback&) override; | 93 const content::PushMessagingService::UnregisterCallback&) override; |
88 blink::WebPushPermissionStatus GetPermissionStatus( | 94 blink::WebPushPermissionStatus GetPermissionStatus( |
89 const GURL& requesting_origin, | 95 const GURL& requesting_origin, |
90 const GURL& embedding_origin, | 96 const GURL& embedding_origin, |
91 bool user_visible) override; | 97 bool user_visible) override; |
92 bool SupportNonVisibleMessages() override; | 98 bool SupportNonVisibleMessages() override; |
93 | 99 |
94 | 100 |
95 // content_settings::Observer implementation. | 101 // content_settings::Observer implementation. |
(...skipping 21 matching lines...) Expand all Loading... |
117 int64 service_worker_registration_id, | 123 int64 service_worker_registration_id, |
118 const gcm::IncomingMessage& message, | 124 const gcm::IncomingMessage& message, |
119 const base::Closure& message_handled_closure, | 125 const base::Closure& message_handled_closure, |
120 content::PushDeliveryStatus status); | 126 content::PushDeliveryStatus status); |
121 | 127 |
122 // Subscribe methods --------------------------------------------------------- | 128 // Subscribe methods --------------------------------------------------------- |
123 | 129 |
124 void SubscribeEnd( | 130 void SubscribeEnd( |
125 const content::PushMessagingService::RegisterCallback& callback, | 131 const content::PushMessagingService::RegisterCallback& callback, |
126 const std::string& subscription_id, | 132 const std::string& subscription_id, |
| 133 const std::vector<uint8_t>& curve25519dh, |
| 134 content::PushRegistrationStatus status); |
| 135 |
| 136 void SubscribeEndWithError( |
| 137 const content::PushMessagingService::RegisterCallback& callback, |
127 content::PushRegistrationStatus status); | 138 content::PushRegistrationStatus status); |
128 | 139 |
129 void DidSubscribe( | 140 void DidSubscribe( |
130 const PushMessagingAppIdentifier& app_identifier, | 141 const PushMessagingAppIdentifier& app_identifier, |
131 const content::PushMessagingService::RegisterCallback& callback, | 142 const content::PushMessagingService::RegisterCallback& callback, |
132 const std::string& subscription_id, | 143 const std::string& subscription_id, |
133 gcm::GCMClient::Result result); | 144 gcm::GCMClient::Result result); |
134 | 145 |
135 void DidRequestPermission( | 146 void DidRequestPermission( |
136 const PushMessagingAppIdentifier& app_identifier, | 147 const PushMessagingAppIdentifier& app_identifier, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // 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, |
180 // keyed by the receiver's app id. | 191 // keyed by the receiver's app id. |
181 std::multiset<std::string> in_flight_message_deliveries_; | 192 std::multiset<std::string> in_flight_message_deliveries_; |
182 | 193 |
183 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 194 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
184 | 195 |
185 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 196 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
186 }; | 197 }; |
187 | 198 |
188 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ | 199 #endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ |
OLD | NEW |