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

Side by Side Diff: third_party/WebKit/Source/platform/network/mime/MockMimeRegistry.h

Issue 2444873002: Move WebMIMERegistry impl from //content to blink:platform/network/mime (Closed)
Patch Set: remove indirection Created 4 years, 1 month 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
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 #ifndef MockMimeRegistry_h
6 #define MockMimeRegistry_h
7
8 #include "mojo/public/cpp/bindings/binding.h"
9 #include "net/base/mime_util.h"
10 #include "public/platform/FilePathConversion.h"
11 #include "public/platform/mime_registry.mojom-blink.h"
12
13 namespace blink {
14
15 // Used for unit tests.
16 class MockMimeRegistry : public mojom::blink::MimeRegistry {
17 public:
18 MockMimeRegistry(mojom::blink::MimeRegistryRequest request)
19 : m_binding(this, std::move(request)) {}
20 ~MockMimeRegistry() {}
21
22 void GetMimeTypeFromExtension(
23 const String& ext,
24 const GetMimeTypeFromExtensionCallback& callback) override {
25 std::string mimeType;
26 net::GetMimeTypeFromExtension(WebStringToFilePath(ext).value(), &mimeType);
27 callback.Run(String::fromUTF8(mimeType.data(), mimeType.length()));
28 }
29
30 mojo::Binding<mojom::blink::MimeRegistry> m_binding;
31 };
32
33 } // namespace blink
34
35 #endif // MockMimeRegistry_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698