Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/mime_registry_impl.h" | |
| 6 | |
| 7 #include "base/files/file_path.h" | |
| 8 #include "content/public/browser/browser_thread.h" | |
| 9 #include "mojo/common/common_type_converters.h" | |
| 10 #include "net/base/mime_util.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 // static | |
| 15 void MimeRegistryImpl::Create(blink::mojom::MimeRegistryRequest request) { | |
| 16 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 17 new MimeRegistryImpl(std::move(request)); | |
| 18 } | |
| 19 | |
| 20 MimeRegistryImpl::MimeRegistryImpl(blink::mojom::MimeRegistryRequest request) | |
| 21 : binding_(this, std::move(request)) {} | |
| 22 | |
| 23 MimeRegistryImpl::~MimeRegistryImpl() = default; | |
| 24 | |
| 25 void MimeRegistryImpl::GetMimeTypeFromExtension( | |
| 26 const mojo::String& extension, | |
| 27 const GetMimeTypeFromExtensionCallback& callback) { | |
|
nasko
2016/06/02 21:31:41
nit: Since this is expected to be invoked on the F
Sam McNally
2016/06/02 23:49:39
Done.
| |
| 28 std::string mime_type; | |
| 29 net::GetMimeTypeFromExtension(extension.To<base::FilePath::StringType>(), | |
| 30 &mime_type); | |
| 31 callback.Run(mime_type); | |
| 32 } | |
| 33 | |
| 34 } // namespace content | |
| OLD | NEW |