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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: mojo/services/network/network_service_impl.cc
diff --git a/mojo/services/network/network_service_impl.cc b/mojo/services/network/network_service_impl.cc
index 661f7e0cf6f910523c69c04cf840e0633c2e89a6..1b77db3fca2318b2e6b465acaa02d1a52daa2709 100644
--- a/mojo/services/network/network_service_impl.cc
+++ b/mojo/services/network/network_service_impl.cc
@@ -12,6 +12,7 @@
#include "mojo/services/network/udp_socket_impl.h"
#include "mojo/services/network/url_loader_impl.h"
#include "mojo/services/network/web_socket_impl.h"
+#include "net/base/mime_util.h"
namespace mojo {
@@ -78,4 +79,13 @@ void NetworkServiceImpl::CreateHttpServer(
app_refcount_->Clone(), callback);
}
+void NetworkServiceImpl::GetMimeTypeFromFile(
+ const mojo::String& file_path,
+ const GetMimeTypeFromFileCallback& callback) {
+ std::string mime;
+ net::GetMimeTypeFromFile(
+ base::FilePath::FromUTF8Unsafe(file_path.To<std::string>()), &mime);
+ callback.Run(mime);
+}
+
} // namespace mojo
« 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