| Index: content/child/push_messaging/push_provider.cc
|
| diff --git a/content/child/push_messaging/push_provider.cc b/content/child/push_messaging/push_provider.cc
|
| index 927da07baa35fd30984f680cc51c482e0198c973..92f435954d309e7922638d7ffe4e834fc762e38f 100644
|
| --- a/content/child/push_messaging/push_provider.cc
|
| +++ b/content/child/push_messaging/push_provider.cc
|
| @@ -26,12 +26,20 @@ int CurrentWorkerId() {
|
|
|
| // Returns the id of the given |service_worker_registration|, which
|
| // is only available on the implementation of the interface.
|
| -int64 GetServiceWorkerRegistrationId(
|
| +int64_t GetServiceWorkerRegistrationId(
|
| blink::WebServiceWorkerRegistration* service_worker_registration) {
|
| return static_cast<WebServiceWorkerRegistrationImpl*>(
|
| service_worker_registration)->registration_id();
|
| }
|
|
|
| +GURL GetServiceWorkerRegistrationOrigin(
|
| + blink::WebServiceWorkerRegistration* service_worker_registration) {
|
| + blink::WebURL scope = static_cast<WebServiceWorkerRegistrationImpl*>(
|
| + service_worker_registration)->scope();
|
| +
|
| + return GURL(scope).GetOrigin();
|
| +}
|
| +
|
| } // namespace
|
|
|
| static base::LazyInstance<base::ThreadLocalPointer<PushProvider>>::Leaky
|
| @@ -73,7 +81,7 @@ void PushProvider::subscribe(
|
| DCHECK(callbacks);
|
| int request_id = push_dispatcher_->GenerateRequestId(CurrentWorkerId());
|
| subscription_callbacks_.AddWithID(callbacks, request_id);
|
| - int64 service_worker_registration_id =
|
| + int64_t service_worker_registration_id =
|
| GetServiceWorkerRegistrationId(service_worker_registration);
|
| thread_safe_sender_->Send(new PushMessagingHostMsg_SubscribeFromWorker(
|
| request_id, service_worker_registration_id, options.userVisibleOnly));
|
| @@ -88,7 +96,7 @@ void PushProvider::unsubscribe(
|
| int request_id = push_dispatcher_->GenerateRequestId(CurrentWorkerId());
|
| unsubscribe_callbacks_.AddWithID(callbacks, request_id);
|
|
|
| - int64 service_worker_registration_id =
|
| + int64_t service_worker_registration_id =
|
| GetServiceWorkerRegistrationId(service_worker_registration);
|
| thread_safe_sender_->Send(new PushMessagingHostMsg_Unsubscribe(
|
| request_id, service_worker_registration_id));
|
| @@ -101,10 +109,11 @@ void PushProvider::getSubscription(
|
| DCHECK(callbacks);
|
| int request_id = push_dispatcher_->GenerateRequestId(CurrentWorkerId());
|
| subscription_callbacks_.AddWithID(callbacks, request_id);
|
| - int64 service_worker_registration_id =
|
| + GURL origin = GetServiceWorkerRegistrationOrigin(service_worker_registration);
|
| + int64_t service_worker_registration_id =
|
| GetServiceWorkerRegistrationId(service_worker_registration);
|
| thread_safe_sender_->Send(new PushMessagingHostMsg_GetRegistration(
|
| - request_id, service_worker_registration_id));
|
| + request_id, origin, service_worker_registration_id));
|
| }
|
|
|
| void PushProvider::getPermissionStatus(
|
| @@ -115,7 +124,7 @@ void PushProvider::getPermissionStatus(
|
| DCHECK(callbacks);
|
| int request_id = push_dispatcher_->GenerateRequestId(CurrentWorkerId());
|
| permission_status_callbacks_.AddWithID(callbacks, request_id);
|
| - int64 service_worker_registration_id =
|
| + int64_t service_worker_registration_id =
|
| GetServiceWorkerRegistrationId(service_worker_registration);
|
| thread_safe_sender_->Send(new PushMessagingHostMsg_GetPermissionStatus(
|
| request_id, service_worker_registration_id, options.userVisibleOnly));
|
| @@ -148,14 +157,15 @@ bool PushProvider::OnMessageReceived(const IPC::Message& message) {
|
|
|
| void PushProvider::OnSubscribeFromWorkerSuccess(
|
| int request_id,
|
| - const GURL& endpoint) {
|
| + const GURL& endpoint,
|
| + const std::vector<uint8_t>& curve25519dh) {
|
| blink::WebPushSubscriptionCallbacks* callbacks =
|
| subscription_callbacks_.Lookup(request_id);
|
| if (!callbacks)
|
| return;
|
|
|
| scoped_ptr<blink::WebPushSubscription> subscription(
|
| - new blink::WebPushSubscription(endpoint));
|
| + new blink::WebPushSubscription(endpoint, curve25519dh));
|
| callbacks->onSuccess(subscription.release());
|
|
|
| subscription_callbacks_.Remove(request_id);
|
| @@ -205,14 +215,15 @@ void PushProvider::OnUnsubscribeError(
|
|
|
| void PushProvider::OnGetRegistrationSuccess(
|
| int request_id,
|
| - const GURL& endpoint) {
|
| + const GURL& endpoint,
|
| + const std::vector<uint8_t>& curve25519dh) {
|
| blink::WebPushSubscriptionCallbacks* callbacks =
|
| subscription_callbacks_.Lookup(request_id);
|
| if (!callbacks)
|
| return;
|
|
|
| scoped_ptr<blink::WebPushSubscription> subscription(
|
| - new blink::WebPushSubscription(endpoint));
|
| + new blink::WebPushSubscription(endpoint, curve25519dh));
|
| callbacks->onSuccess(subscription.release());
|
|
|
| subscription_callbacks_.Remove(request_id);
|
|
|