Chromium Code Reviews| Index: content/browser/mime_registry_impl.cc |
| diff --git a/content/browser/mime_registry_impl.cc b/content/browser/mime_registry_impl.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bcb7cb0521c916c9813545c8c292bff5c9368634 |
| --- /dev/null |
| +++ b/content/browser/mime_registry_impl.cc |
| @@ -0,0 +1,34 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/mime_registry_impl.h" |
| + |
| +#include "base/files/file_path.h" |
| +#include "content/public/browser/browser_thread.h" |
| +#include "mojo/common/common_type_converters.h" |
| +#include "net/base/mime_util.h" |
| + |
| +namespace content { |
| + |
| +// static |
| +void MimeRegistryImpl::Create(blink::mojom::MimeRegistryRequest request) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| + new MimeRegistryImpl(std::move(request)); |
| +} |
| + |
| +MimeRegistryImpl::MimeRegistryImpl(blink::mojom::MimeRegistryRequest request) |
| + : binding_(this, std::move(request)) {} |
| + |
| +MimeRegistryImpl::~MimeRegistryImpl() = default; |
| + |
| +void MimeRegistryImpl::GetMimeTypeFromExtension( |
| + const mojo::String& extension, |
| + 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.
|
| + std::string mime_type; |
| + net::GetMimeTypeFromExtension(extension.To<base::FilePath::StringType>(), |
| + &mime_type); |
| + callback.Run(mime_type); |
| +} |
| + |
| +} // namespace content |