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