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/push_messaging_client.h" | 5 #include "content/renderer/push_messaging/push_messaging_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "content/child/child_thread_impl.h" | 13 #include "content/child/child_thread_impl.h" |
14 #include "content/child/push_messaging/push_provider.h" | 14 #include "content/child/push_messaging/push_provider.h" |
15 #include "content/child/service_worker/web_service_worker_registration_impl.h" | 15 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
| 16 #include "content/public/common/service_names.mojom.h" |
16 #include "content/renderer/manifest/manifest_manager.h" | 17 #include "content/renderer/manifest/manifest_manager.h" |
17 #include "content/renderer/render_frame_impl.h" | 18 #include "content/renderer/render_frame_impl.h" |
18 #include "services/service_manager/public/cpp/interface_provider.h" | 19 #include "services/service_manager/public/cpp/connector.h" |
19 #include "third_party/WebKit/public/platform/WebString.h" | 20 #include "third_party/WebKit/public/platform/WebString.h" |
20 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushError
.h" | 21 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushError
.h" |
21 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubsc
ription.h" | 22 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubsc
ription.h" |
22 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubsc
riptionOptions.h" | 23 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubsc
riptionOptions.h" |
23 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRegistration.h" | 24 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRegistration.h" |
24 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 25 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
25 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 26 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
26 #include "url/gurl.h" | 27 #include "url/gurl.h" |
27 | 28 |
28 namespace content { | 29 namespace content { |
29 | 30 |
30 PushMessagingClient::PushMessagingClient(RenderFrame* render_frame) | 31 PushMessagingClient::PushMessagingClient(RenderFrame* render_frame) |
31 : RenderFrameObserver(render_frame) { | 32 : RenderFrameObserver(render_frame) { |
32 if (ChildThreadImpl::current()) { | 33 if (ChildThreadImpl::current()) { |
33 ChildThreadImpl::current()->GetRemoteInterfaces()->GetInterface( | 34 ChildThreadImpl::current()->GetConnector()->BindInterface( |
| 35 mojom::kBrowserServiceName, |
34 mojo::MakeRequest(&push_messaging_manager_)); | 36 mojo::MakeRequest(&push_messaging_manager_)); |
35 } | 37 } |
36 } | 38 } |
37 | 39 |
38 PushMessagingClient::~PushMessagingClient() {} | 40 PushMessagingClient::~PushMessagingClient() {} |
39 | 41 |
40 void PushMessagingClient::OnDestruct() { | 42 void PushMessagingClient::OnDestruct() { |
41 delete this; | 43 delete this; |
42 } | 44 } |
43 | 45 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 callbacks->onSuccess(base::MakeUnique<blink::WebPushSubscription>( | 139 callbacks->onSuccess(base::MakeUnique<blink::WebPushSubscription>( |
138 endpoint.value(), options.value().user_visible_only, | 140 endpoint.value(), options.value().user_visible_only, |
139 blink::WebString::fromLatin1(options.value().sender_info), | 141 blink::WebString::fromLatin1(options.value().sender_info), |
140 p256dh.value(), auth.value())); | 142 p256dh.value(), auth.value())); |
141 } else { | 143 } else { |
142 callbacks->onError(PushRegistrationStatusToWebPushError(status)); | 144 callbacks->onError(PushRegistrationStatusToWebPushError(status)); |
143 } | 145 } |
144 } | 146 } |
145 | 147 |
146 } // namespace content | 148 } // namespace content |
OLD | NEW |