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 #include "content/renderer/push_messaging_dispatcher.h" | 5 #include "content/renderer/push_messaging_dispatcher.h" |
6 | 6 |
7 #include "content/common/push_messaging_messages.h" | 7 #include "content/common/push_messaging_messages.h" |
8 #include "content/renderer/render_view_impl.h" | 8 #include "content/renderer/render_view_impl.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "third_party/WebKit/public/platform/WebPushError.h" | 10 #include "third_party/WebKit/public/platform/WebPushError.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 IPC_BEGIN_MESSAGE_MAP(PushMessagingDispatcher, message) | 26 IPC_BEGIN_MESSAGE_MAP(PushMessagingDispatcher, message) |
27 IPC_MESSAGE_HANDLER(PushMessagingMsg_RegisterSuccess, OnRegisterSuccess) | 27 IPC_MESSAGE_HANDLER(PushMessagingMsg_RegisterSuccess, OnRegisterSuccess) |
28 IPC_MESSAGE_HANDLER(PushMessagingMsg_RegisterError, OnRegisterError) | 28 IPC_MESSAGE_HANDLER(PushMessagingMsg_RegisterError, OnRegisterError) |
29 IPC_MESSAGE_UNHANDLED(handled = false) | 29 IPC_MESSAGE_UNHANDLED(handled = false) |
30 IPC_END_MESSAGE_MAP() | 30 IPC_END_MESSAGE_MAP() |
31 return handled; | 31 return handled; |
32 } | 32 } |
33 | 33 |
34 void PushMessagingDispatcher::registerPushMessaging( | 34 void PushMessagingDispatcher::registerPushMessaging( |
35 const WebString& sender_id, | 35 const WebString& sender_id, |
36 blink::WebPushRegistrationCallbacks* callbacks) { | 36 blink::WebPushRegistrationCallbacks* callbacks, |
| 37 const blink::WebURL& url, |
| 38 int service_worker_provider_id) { |
37 DCHECK(callbacks); | 39 DCHECK(callbacks); |
38 int callbacks_id = registration_callbacks_.Add(callbacks); | 40 int callbacks_id = registration_callbacks_.Add(callbacks); |
39 Send(new PushMessagingHostMsg_Register( | 41 GURL gurl(url); |
40 routing_id(), callbacks_id, sender_id.utf8())); | 42 LOG(WARNING) << gurl; |
| 43 Send(new PushMessagingHostMsg_Register(routing_id(), |
| 44 callbacks_id, |
| 45 sender_id.utf8(), |
| 46 gurl, |
| 47 service_worker_provider_id)); |
41 } | 48 } |
42 | 49 |
43 void PushMessagingDispatcher::OnRegisterSuccess( | 50 void PushMessagingDispatcher::OnRegisterSuccess( |
44 int32 callbacks_id, | 51 int32 callbacks_id, |
45 const GURL& endpoint, | 52 const GURL& endpoint, |
46 const std::string& registration_id) { | 53 const std::string& registration_id) { |
47 blink::WebPushRegistrationCallbacks* callbacks = | 54 blink::WebPushRegistrationCallbacks* callbacks = |
48 registration_callbacks_.Lookup(callbacks_id); | 55 registration_callbacks_.Lookup(callbacks_id); |
49 CHECK(callbacks); | 56 CHECK(callbacks); |
50 | 57 |
(...skipping 13 matching lines...) Expand all Loading... |
64 | 71 |
65 scoped_ptr<blink::WebPushError> error( | 72 scoped_ptr<blink::WebPushError> error( |
66 new blink::WebPushError( | 73 new blink::WebPushError( |
67 blink::WebPushError::ErrorTypeAbort, | 74 blink::WebPushError::ErrorTypeAbort, |
68 WebString::fromUTF8(kAbortErrorReason))); | 75 WebString::fromUTF8(kAbortErrorReason))); |
69 callbacks->onError(error.release()); | 76 callbacks->onError(error.release()); |
70 registration_callbacks_.Remove(callbacks_id); | 77 registration_callbacks_.Remove(callbacks_id); |
71 } | 78 } |
72 | 79 |
73 } // namespace content | 80 } // namespace content |
OLD | NEW |