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 "mojo/services/network/network_service_impl.h" | 5 #include "mojo/services/network/network_service_impl.h" |
6 | 6 |
7 #include "mojo/public/cpp/application/application_connection.h" | 7 #include "mojo/public/cpp/application/application_connection.h" |
8 #include "mojo/services/network/cookie_store_impl.h" | 8 #include "mojo/services/network/cookie_store_impl.h" |
| 9 #include "mojo/services/network/udp_socket_impl.h" |
9 #include "mojo/services/network/url_loader_impl.h" | 10 #include "mojo/services/network/url_loader_impl.h" |
10 #include "mojo/services/network/web_socket_impl.h" | 11 #include "mojo/services/network/web_socket_impl.h" |
11 | 12 |
12 namespace mojo { | 13 namespace mojo { |
13 | 14 |
14 NetworkServiceImpl::NetworkServiceImpl(ApplicationConnection* connection, | 15 NetworkServiceImpl::NetworkServiceImpl(ApplicationConnection* connection, |
15 NetworkContext* context) | 16 NetworkContext* context) |
16 : context_(context), | 17 : context_(context), |
17 origin_(GURL(connection->GetRemoteApplicationURL()).GetOrigin()) { | 18 origin_(GURL(connection->GetRemoteApplicationURL()).GetOrigin()) { |
18 } | 19 } |
19 | 20 |
20 NetworkServiceImpl::~NetworkServiceImpl() { | 21 NetworkServiceImpl::~NetworkServiceImpl() { |
21 } | 22 } |
22 | 23 |
23 void NetworkServiceImpl::CreateURLLoader(InterfaceRequest<URLLoader> loader) { | 24 void NetworkServiceImpl::CreateURLLoader(InterfaceRequest<URLLoader> loader) { |
24 // TODO(darin): Plumb origin_. Use for CORS. | 25 // TODO(darin): Plumb origin_. Use for CORS. |
25 BindToRequest(new URLLoaderImpl(context_), &loader); | 26 BindToRequest(new URLLoaderImpl(context_), &loader); |
26 } | 27 } |
27 | 28 |
28 void NetworkServiceImpl::GetCookieStore(InterfaceRequest<CookieStore> store) { | 29 void NetworkServiceImpl::GetCookieStore(InterfaceRequest<CookieStore> store) { |
29 BindToRequest(new CookieStoreImpl(context_, origin_), &store); | 30 BindToRequest(new CookieStoreImpl(context_, origin_), &store); |
30 } | 31 } |
31 | 32 |
32 void NetworkServiceImpl::CreateWebSocket(InterfaceRequest<WebSocket> socket) { | 33 void NetworkServiceImpl::CreateWebSocket(InterfaceRequest<WebSocket> socket) { |
33 BindToRequest(new WebSocketImpl(context_), &socket); | 34 BindToRequest(new WebSocketImpl(context_), &socket); |
34 } | 35 } |
35 | 36 |
| 37 void NetworkServiceImpl::CreateUDPSocket(InterfaceRequest<UDPSocket> socket) { |
| 38 BindToRequest(new UDPSocketImpl(), &socket); |
| 39 } |
| 40 |
36 } // namespace mojo | 41 } // namespace mojo |
OLD | NEW |