OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/mime_registry_impl.h" | 5 #include "content/browser/mime_registry_impl.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "mojo/public/cpp/bindings/strong_binding.h" | 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
11 #include "net/base/mime_util.h" | 11 #include "net/base/mime_util.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 MimeRegistryImpl::MimeRegistryImpl() = default; | 15 MimeRegistryImpl::MimeRegistryImpl() = default; |
16 | 16 |
17 MimeRegistryImpl::~MimeRegistryImpl() = default; | 17 MimeRegistryImpl::~MimeRegistryImpl() = default; |
18 | 18 |
19 // static | 19 // static |
20 void MimeRegistryImpl::Create(blink::mojom::MimeRegistryRequest request) { | 20 void MimeRegistryImpl::Create( |
| 21 const service_manager::BindSourceInfo& source_info, |
| 22 blink::mojom::MimeRegistryRequest request) { |
21 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 23 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
22 mojo::MakeStrongBinding(base::MakeUnique<MimeRegistryImpl>(), | 24 mojo::MakeStrongBinding(base::MakeUnique<MimeRegistryImpl>(), |
23 std::move(request)); | 25 std::move(request)); |
24 } | 26 } |
25 | 27 |
26 void MimeRegistryImpl::GetMimeTypeFromExtension( | 28 void MimeRegistryImpl::GetMimeTypeFromExtension( |
27 const std::string& extension, | 29 const std::string& extension, |
28 const GetMimeTypeFromExtensionCallback& callback) { | 30 const GetMimeTypeFromExtensionCallback& callback) { |
29 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 31 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
30 std::string mime_type; | 32 std::string mime_type; |
31 net::GetMimeTypeFromExtension( | 33 net::GetMimeTypeFromExtension( |
32 base::FilePath::FromUTF8Unsafe(extension).value(), &mime_type); | 34 base::FilePath::FromUTF8Unsafe(extension).value(), &mime_type); |
33 callback.Run(mime_type); | 35 callback.Run(mime_type); |
34 } | 36 } |
35 | 37 |
36 } // namespace content | 38 } // namespace content |
OLD | NEW |