Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: mojo/services/network/network_service_impl.cc

Issue 1290323002: HTMLViewer no longer connects to NetworkService interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
8 #include "mojo/services/network/cookie_store_impl.h"
9 #include "mojo/services/network/http_server_impl.h" 7 #include "mojo/services/network/http_server_impl.h"
10 #include "mojo/services/network/net_adapters.h" 8 #include "mojo/services/network/net_adapters.h"
11 #include "mojo/services/network/tcp_bound_socket_impl.h" 9 #include "mojo/services/network/tcp_bound_socket_impl.h"
12 #include "mojo/services/network/udp_socket_impl.h" 10 #include "mojo/services/network/udp_socket_impl.h"
13 #include "mojo/services/network/url_loader_impl.h" 11 #include "mojo/services/network/url_loader_impl.h"
14 #include "mojo/services/network/web_socket_impl.h"
15 #include "net/base/mime_util.h" 12 #include "net/base/mime_util.h"
16 13
17 namespace mojo { 14 namespace mojo {
18 15
19 NetworkServiceImpl::NetworkServiceImpl( 16 NetworkServiceImpl::NetworkServiceImpl(
20 ApplicationConnection* connection,
21 NetworkContext* context,
22 scoped_ptr<mojo::AppRefCount> app_refcount, 17 scoped_ptr<mojo::AppRefCount> app_refcount,
23 InterfaceRequest<NetworkService> request) 18 InterfaceRequest<NetworkService> request)
24 : context_(context), 19 : app_refcount_(app_refcount.Pass()),
25 app_refcount_(app_refcount.Pass()),
26 origin_(GURL(connection->GetRemoteApplicationURL()).GetOrigin()),
27 binding_(this, request.Pass()) { 20 binding_(this, request.Pass()) {
28 } 21 }
29 22
30 NetworkServiceImpl::~NetworkServiceImpl() { 23 NetworkServiceImpl::~NetworkServiceImpl() {
31 } 24 }
32 25
33 void NetworkServiceImpl::GetCookieStore(InterfaceRequest<CookieStore> store) {
34 new CookieStoreImpl(context_, origin_, app_refcount_->Clone(), store.Pass());
35 }
36
37 void NetworkServiceImpl::CreateWebSocket(InterfaceRequest<WebSocket> socket) {
38 new WebSocketImpl(context_, app_refcount_->Clone(), socket.Pass());
39 }
40
41 void NetworkServiceImpl::CreateTCPBoundSocket( 26 void NetworkServiceImpl::CreateTCPBoundSocket(
42 NetAddressPtr local_address, 27 NetAddressPtr local_address,
43 InterfaceRequest<TCPBoundSocket> bound_socket, 28 InterfaceRequest<TCPBoundSocket> bound_socket,
44 const CreateTCPBoundSocketCallback& callback) { 29 const CreateTCPBoundSocketCallback& callback) {
45 scoped_ptr<TCPBoundSocketImpl> bound(new TCPBoundSocketImpl( 30 scoped_ptr<TCPBoundSocketImpl> bound(new TCPBoundSocketImpl(
46 app_refcount_->Clone(), bound_socket.Pass())); 31 app_refcount_->Clone(), bound_socket.Pass()));
47 int net_error = bound->Bind(local_address.Pass()); 32 int net_error = bound->Bind(local_address.Pass());
48 if (net_error != net::OK) { 33 if (net_error != net::OK) {
49 callback.Run(MakeNetworkError(net_error), NetAddressPtr()); 34 callback.Run(MakeNetworkError(net_error), NetAddressPtr());
50 return; 35 return;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void NetworkServiceImpl::GetMimeTypeFromFile( 67 void NetworkServiceImpl::GetMimeTypeFromFile(
83 const mojo::String& file_path, 68 const mojo::String& file_path,
84 const GetMimeTypeFromFileCallback& callback) { 69 const GetMimeTypeFromFileCallback& callback) {
85 std::string mime; 70 std::string mime;
86 net::GetMimeTypeFromFile( 71 net::GetMimeTypeFromFile(
87 base::FilePath::FromUTF8Unsafe(file_path.To<std::string>()), &mime); 72 base::FilePath::FromUTF8Unsafe(file_path.To<std::string>()), &mime);
88 callback.Run(mime); 73 callback.Run(mime);
89 } 74 }
90 75
91 } // namespace mojo 76 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/network/network_service_impl.h ('k') | mojo/services/network/public/interfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698