OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/service_worker/web_service_worker_impl.h" | 5 #include "content/child/service_worker/web_service_worker_impl.h" |
6 | 6 |
| 7 #include "content/child/thread_safe_sender.h" |
| 8 #include "content/child/webmessageportchannel_impl.h" |
| 9 #include "content/common/service_worker/service_worker_messages.h" |
| 10 #include "ipc/ipc_message.h" |
| 11 #include "third_party/WebKit/public/platform/WebString.h" |
| 12 |
| 13 using blink::WebMessagePortChannel; |
| 14 using blink::WebMessagePortChannelArray; |
| 15 using blink::WebMessagePortChannelClient; |
| 16 using blink::WebString; |
| 17 |
7 namespace content { | 18 namespace content { |
8 | 19 |
9 WebServiceWorkerImpl::~WebServiceWorkerImpl() {} | 20 WebServiceWorkerImpl::~WebServiceWorkerImpl() {} |
10 | 21 |
| 22 void WebServiceWorkerImpl::postMessage( |
| 23 const WebString& message, |
| 24 WebMessagePortChannelArray* channels) { |
| 25 PostMessage(message, channels); |
| 26 } |
| 27 |
| 28 void WebServiceWorkerImpl::PostMessage( |
| 29 const base::string16& message, |
| 30 WebMessagePortChannelArray* channels) { |
| 31 std::vector<int> message_port_ids; |
| 32 WebMessagePortChannelImpl::ExtractMessagePortIDs(channels, &message_port_ids); |
| 33 thread_safe_sender_->Send(new ServiceWorkerHostMsg_PostMessage( |
| 34 registration_id_, message, message_port_ids)); |
| 35 } |
| 36 |
11 } // namespace content | 37 } // namespace content |
OLD | NEW |