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/browser/navigator_connect/navigator_connect_context_impl.h" | 5 #include "content/browser/navigator_connect/navigator_connect_context_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "content/browser/message_port_service.h" | 10 #include "content/browser/message_port_service.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 ServiceWorkerVersion* active_version = registration->active_version(); | 148 ServiceWorkerVersion* active_version = registration->active_version(); |
149 DCHECK(active_version); | 149 DCHECK(active_version); |
150 | 150 |
151 Port& service_port = ports_[service_port_id]; | 151 Port& service_port = ports_[service_port_id]; |
152 service_port.service_worker_registration_id = registration->id(); | 152 service_port.service_worker_registration_id = registration->id(); |
153 service_port.service_worker_registration_origin = | 153 service_port.service_worker_registration_origin = |
154 registration->pattern().GetOrigin(); | 154 registration->pattern().GetOrigin(); |
155 | 155 |
156 active_version->RunAfterStartWorker( | 156 active_version->RunAfterStartWorker( |
157 base::Bind(&NavigatorConnectContextImpl::OnConnectError, this, callback, | |
158 client_port_id, service_port_id), | |
159 base::Bind(&NavigatorConnectContextImpl::DispatchConnectEvent, this, | 157 base::Bind(&NavigatorConnectContextImpl::DispatchConnectEvent, this, |
160 callback, client_port_id, service_port_id, registration, | 158 callback, client_port_id, service_port_id, registration, |
161 make_scoped_refptr(active_version))); | 159 make_scoped_refptr(active_version)), |
| 160 base::Bind(&NavigatorConnectContextImpl::OnConnectError, this, callback, |
| 161 client_port_id, service_port_id)); |
162 } | 162 } |
163 | 163 |
164 void NavigatorConnectContextImpl::DispatchConnectEvent( | 164 void NavigatorConnectContextImpl::DispatchConnectEvent( |
165 const ConnectCallback& callback, | 165 const ConnectCallback& callback, |
166 int client_port_id, | 166 int client_port_id, |
167 int service_port_id, | 167 int service_port_id, |
168 const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration, | 168 const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration, |
169 const scoped_refptr<ServiceWorkerVersion>& worker) { | 169 const scoped_refptr<ServiceWorkerVersion>& worker) { |
170 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 170 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
171 DCHECK(ContainsKey(ports_, client_port_id)); | 171 DCHECK(ContainsKey(ports_, client_port_id)); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 DCHECK(active_version); | 257 DCHECK(active_version); |
258 | 258 |
259 const Port& port = ports_[port_id]; | 259 const Port& port = ports_[port_id]; |
260 NavigatorConnectClient client(port.target_url, port.client_origin, port_id); | 260 NavigatorConnectClient client(port.target_url, port.client_origin, port_id); |
261 active_version->DispatchCrossOriginMessageEvent( | 261 active_version->DispatchCrossOriginMessageEvent( |
262 client, message, sent_message_ports, | 262 client, message, sent_message_ports, |
263 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 263 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
264 } | 264 } |
265 | 265 |
266 } // namespace content | 266 } // namespace content |
OLD | NEW |