| 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/application/public/cpp/application_connection.h" | 7 #include "mojo/application/public/cpp/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/http_server_impl.h" | 9 #include "mojo/services/network/http_server_impl.h" |
| 10 #include "mojo/services/network/net_adapters.h" | 10 #include "mojo/services/network/net_adapters.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 InterfaceRequest<NetworkService> request) | 22 InterfaceRequest<NetworkService> request) |
| 23 : context_(context), | 23 : context_(context), |
| 24 app_refcount_(app_refcount.Pass()), | 24 app_refcount_(app_refcount.Pass()), |
| 25 origin_(GURL(connection->GetRemoteApplicationURL()).GetOrigin()), | 25 origin_(GURL(connection->GetRemoteApplicationURL()).GetOrigin()), |
| 26 binding_(this, request.Pass()) { | 26 binding_(this, request.Pass()) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 NetworkServiceImpl::~NetworkServiceImpl() { | 29 NetworkServiceImpl::~NetworkServiceImpl() { |
| 30 } | 30 } |
| 31 | 31 |
| 32 void NetworkServiceImpl::CreateURLLoader(InterfaceRequest<URLLoader> loader) { | |
| 33 // TODO(darin): Plumb origin_. Use for CORS. | |
| 34 // The loader will delete itself when the pipe is closed, unless a request is | |
| 35 // in progress. In which case, the loader will delete itself when the request | |
| 36 // is finished. | |
| 37 new URLLoaderImpl(context_, loader.Pass(), app_refcount_->Clone()); | |
| 38 } | |
| 39 | |
| 40 void NetworkServiceImpl::GetCookieStore(InterfaceRequest<CookieStore> store) { | 32 void NetworkServiceImpl::GetCookieStore(InterfaceRequest<CookieStore> store) { |
| 41 new CookieStoreImpl(context_, origin_, app_refcount_->Clone(), store.Pass()); | 33 new CookieStoreImpl(context_, origin_, app_refcount_->Clone(), store.Pass()); |
| 42 } | 34 } |
| 43 | 35 |
| 44 void NetworkServiceImpl::CreateWebSocket(InterfaceRequest<WebSocket> socket) { | 36 void NetworkServiceImpl::CreateWebSocket(InterfaceRequest<WebSocket> socket) { |
| 45 new WebSocketImpl(context_, app_refcount_->Clone(), socket.Pass()); | 37 new WebSocketImpl(context_, app_refcount_->Clone(), socket.Pass()); |
| 46 } | 38 } |
| 47 | 39 |
| 48 void NetworkServiceImpl::CreateTCPBoundSocket( | 40 void NetworkServiceImpl::CreateTCPBoundSocket( |
| 49 NetAddressPtr local_address, | 41 NetAddressPtr local_address, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 80 | 72 |
| 81 void NetworkServiceImpl::CreateHttpServer( | 73 void NetworkServiceImpl::CreateHttpServer( |
| 82 NetAddressPtr local_address, | 74 NetAddressPtr local_address, |
| 83 HttpServerDelegatePtr delegate, | 75 HttpServerDelegatePtr delegate, |
| 84 const CreateHttpServerCallback& callback) { | 76 const CreateHttpServerCallback& callback) { |
| 85 HttpServerImpl::Create(local_address.Pass(), delegate.Pass(), | 77 HttpServerImpl::Create(local_address.Pass(), delegate.Pass(), |
| 86 app_refcount_->Clone(), callback); | 78 app_refcount_->Clone(), callback); |
| 87 } | 79 } |
| 88 | 80 |
| 89 } // namespace mojo | 81 } // namespace mojo |
| OLD | NEW |