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

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

Issue 1274433003: Add GetMimeTypeFromFile to Mojo's network service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix string usage and NativeApplicationLoaderTest. 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" 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"
11 #include "mojo/services/network/tcp_bound_socket_impl.h" 11 #include "mojo/services/network/tcp_bound_socket_impl.h"
12 #include "mojo/services/network/udp_socket_impl.h" 12 #include "mojo/services/network/udp_socket_impl.h"
13 #include "mojo/services/network/url_loader_impl.h" 13 #include "mojo/services/network/url_loader_impl.h"
14 #include "mojo/services/network/web_socket_impl.h" 14 #include "mojo/services/network/web_socket_impl.h"
15 #include "net/base/mime_util.h"
15 16
16 namespace mojo { 17 namespace mojo {
17 18
18 NetworkServiceImpl::NetworkServiceImpl( 19 NetworkServiceImpl::NetworkServiceImpl(
19 ApplicationConnection* connection, 20 ApplicationConnection* connection,
20 NetworkContext* context, 21 NetworkContext* context,
21 scoped_ptr<mojo::AppRefCount> app_refcount, 22 scoped_ptr<mojo::AppRefCount> app_refcount,
22 InterfaceRequest<NetworkService> request) 23 InterfaceRequest<NetworkService> request)
23 : context_(context), 24 : context_(context),
24 app_refcount_(app_refcount.Pass()), 25 app_refcount_(app_refcount.Pass()),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 72 }
72 73
73 void NetworkServiceImpl::CreateHttpServer( 74 void NetworkServiceImpl::CreateHttpServer(
74 NetAddressPtr local_address, 75 NetAddressPtr local_address,
75 HttpServerDelegatePtr delegate, 76 HttpServerDelegatePtr delegate,
76 const CreateHttpServerCallback& callback) { 77 const CreateHttpServerCallback& callback) {
77 HttpServerImpl::Create(local_address.Pass(), delegate.Pass(), 78 HttpServerImpl::Create(local_address.Pass(), delegate.Pass(),
78 app_refcount_->Clone(), callback); 79 app_refcount_->Clone(), callback);
79 } 80 }
80 81
82 void NetworkServiceImpl::GetMimeTypeFromFile(
83 const mojo::String& file_path,
84 const GetMimeTypeFromFileCallback& callback) {
85 std::string mime;
86 net::GetMimeTypeFromFile(
87 base::FilePath::FromUTF8Unsafe(file_path.To<std::string>()), &mime);
88 callback.Run(mime);
89 }
90
81 } // namespace mojo 91 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/network/network_service_impl.h ('k') | mojo/services/network/public/interfaces/network_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698