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/browser/service_worker/service_worker_provider_host.h" | 5 #include "content/browser/service_worker/service_worker_provider_host.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "content/browser/service_worker/service_worker_context_core.h" | 8 #include "content/browser/service_worker/service_worker_context_core.h" |
9 #include "content/browser/service_worker/service_worker_context_request_handler.
h" | 9 #include "content/browser/service_worker/service_worker_context_request_handler.
h" |
10 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" | 10 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || | 112 if (ServiceWorkerUtils::IsMainResourceType(resource_type) || |
113 active_version()) { | 113 active_version()) { |
114 return scoped_ptr<ServiceWorkerRequestHandler>( | 114 return scoped_ptr<ServiceWorkerRequestHandler>( |
115 new ServiceWorkerControlleeRequestHandler( | 115 new ServiceWorkerControlleeRequestHandler( |
116 context_, AsWeakPtr(), resource_type)); | 116 context_, AsWeakPtr(), resource_type)); |
117 } | 117 } |
118 return scoped_ptr<ServiceWorkerRequestHandler>(); | 118 return scoped_ptr<ServiceWorkerRequestHandler>(); |
119 } | 119 } |
120 | 120 |
| 121 void ServiceWorkerProviderHost::PostMessage( |
| 122 const base::string16& message, |
| 123 const std::vector<int>& sent_message_port_ids) { |
| 124 if (!dispatcher_host_) |
| 125 return; // Could be NULL in some tests. |
| 126 |
| 127 std::vector<int> new_routing_ids; |
| 128 dispatcher_host_->UpdateMessagePorts(sent_message_port_ids, &new_routing_ids); |
| 129 |
| 130 dispatcher_host_->Send( |
| 131 new ServiceWorkerMsg_MessageToDocument( |
| 132 kDocumentMainThreadId, provider_id(), |
| 133 message, |
| 134 sent_message_port_ids, |
| 135 new_routing_ids)); |
| 136 } |
| 137 |
121 } // namespace content | 138 } // namespace content |
OLD | NEW |