Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: content/renderer/push_messaging/push_messaging_dispatcher.cc

Issue 1210283005: Introduce the PushSubscription.curve25519dh attribute (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "content/renderer/push_messaging/push_messaging_dispatcher.h" 5 #include "content/renderer/push_messaging/push_messaging_dispatcher.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/child/service_worker/web_service_worker_registration_impl.h" 8 #include "content/child/service_worker/web_service_worker_registration_impl.h"
9 #include "content/common/push_messaging_messages.h" 9 #include "content/common/push_messaging_messages.h"
10 #include "content/renderer/manifest/manifest_manager.h" 10 #include "content/renderer/manifest/manifest_manager.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 Send(new PushMessagingHostMsg_SubscribeFromDocument( 77 Send(new PushMessagingHostMsg_SubscribeFromDocument(
78 routing_id(), request_id, 78 routing_id(), request_id,
79 manifest.gcm_sender_id.is_null() 79 manifest.gcm_sender_id.is_null()
80 ? std::string() 80 ? std::string()
81 : base::UTF16ToUTF8(manifest.gcm_sender_id.string()), 81 : base::UTF16ToUTF8(manifest.gcm_sender_id.string()),
82 options.userVisibleOnly, service_worker_registration_id)); 82 options.userVisibleOnly, service_worker_registration_id));
83 } 83 }
84 84
85 void PushMessagingDispatcher::OnSubscribeFromDocumentSuccess( 85 void PushMessagingDispatcher::OnSubscribeFromDocumentSuccess(
86 int32_t request_id, 86 int32_t request_id,
87 const GURL& endpoint) { 87 const GURL& endpoint,
88 const std::vector<uint8_t>& curve25519dh) {
88 blink::WebPushSubscriptionCallbacks* callbacks = 89 blink::WebPushSubscriptionCallbacks* callbacks =
89 subscription_callbacks_.Lookup(request_id); 90 subscription_callbacks_.Lookup(request_id);
90 DCHECK(callbacks); 91 DCHECK(callbacks);
91 92
92 scoped_ptr<blink::WebPushSubscription> subscription( 93 scoped_ptr<blink::WebPushSubscription> subscription(
93 new blink::WebPushSubscription(endpoint)); 94 new blink::WebPushSubscription(endpoint, curve25519dh));
94 callbacks->onSuccess(subscription.release()); 95 callbacks->onSuccess(subscription.release());
95 96
96 subscription_callbacks_.Remove(request_id); 97 subscription_callbacks_.Remove(request_id);
97 } 98 }
98 99
99 void PushMessagingDispatcher::OnSubscribeFromDocumentError( 100 void PushMessagingDispatcher::OnSubscribeFromDocumentError(
100 int32_t request_id, 101 int32_t request_id,
101 PushRegistrationStatus status) { 102 PushRegistrationStatus status) {
102 blink::WebPushSubscriptionCallbacks* callbacks = 103 blink::WebPushSubscriptionCallbacks* callbacks =
103 subscription_callbacks_.Lookup(request_id); 104 subscription_callbacks_.Lookup(request_id);
104 DCHECK(callbacks); 105 DCHECK(callbacks);
105 106
106 scoped_ptr<blink::WebPushError> error(new blink::WebPushError( 107 scoped_ptr<blink::WebPushError> error(new blink::WebPushError(
107 blink::WebPushError::ErrorTypeAbort, 108 blink::WebPushError::ErrorTypeAbort,
108 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); 109 blink::WebString::fromUTF8(PushRegistrationStatusToString(status))));
109 callbacks->onError(error.release()); 110 callbacks->onError(error.release());
110 111
111 subscription_callbacks_.Remove(request_id); 112 subscription_callbacks_.Remove(request_id);
112 } 113 }
113 114
114 } // namespace content 115 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698