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

Side by Side Diff: content/browser/mime_registry_impl.cc

Issue 2024363002: Convert MimeRegistry to use mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@message-mojom-magic
Patch Set: Created 4 years, 6 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
« no previous file with comments | « content/browser/mime_registry_impl.h ('k') | content/browser/mime_registry_message_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
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) {
28 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
29 std::string mime_type;
30 net::GetMimeTypeFromExtension(extension.To<base::FilePath::StringType>(),
31 &mime_type);
32 callback.Run(mime_type);
33 }
34
35 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mime_registry_impl.h ('k') | content/browser/mime_registry_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698