OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/simple_webmimeregistry_impl.h" | 5 #include "content/child/simple_webmimeregistry_impl.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "media/base/mime_util.h" | |
11 #include "net/base/mime_util.h" | 12 #include "net/base/mime_util.h" |
12 #include "third_party/WebKit/public/platform/WebString.h" | 13 #include "third_party/WebKit/public/platform/WebString.h" |
13 | 14 |
14 using blink::WebString; | 15 using blink::WebString; |
15 using blink::WebMimeRegistry; | 16 using blink::WebMimeRegistry; |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 //static | 20 //static |
20 std::string SimpleWebMimeRegistryImpl::ToASCIIOrEmpty(const WebString& string) { | 21 std::string SimpleWebMimeRegistryImpl::ToASCIIOrEmpty(const WebString& string) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 const blink::WebString& key_system, | 63 const blink::WebString& key_system, |
63 const blink::WebString& mime_type, | 64 const blink::WebString& mime_type, |
64 const blink::WebString& codecs) { | 65 const blink::WebString& codecs) { |
65 // Media features are only supported at the content/renderer layer. | 66 // Media features are only supported at the content/renderer layer. |
66 return false; | 67 return false; |
67 } | 68 } |
68 | 69 |
69 WebMimeRegistry::SupportsType | 70 WebMimeRegistry::SupportsType |
70 SimpleWebMimeRegistryImpl::supportsNonImageMIMEType( | 71 SimpleWebMimeRegistryImpl::supportsNonImageMIMEType( |
71 const WebString& mime_type) { | 72 const WebString& mime_type) { |
72 return net::IsSupportedNonImageMimeType(ToASCIIOrEmpty(mime_type)) ? | 73 return (net::IsSupportedNonImageMimeType(ToASCIIOrEmpty(mime_type)) |
74 || media::IsSupportedMediaMimeType(ToASCIIOrEmpty(mime_type))) ? | |
acolwell GONE FROM CHROMIUM
2014/07/17 23:19:31
Now that the media types aren't in the non-image m
| |
73 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; | 75 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; |
74 } | 76 } |
75 | 77 |
76 WebString SimpleWebMimeRegistryImpl::mimeTypeForExtension( | 78 WebString SimpleWebMimeRegistryImpl::mimeTypeForExtension( |
77 const WebString& file_extension) { | 79 const WebString& file_extension) { |
78 std::string mime_type; | 80 std::string mime_type; |
79 net::GetMimeTypeFromExtension( | 81 net::GetMimeTypeFromExtension( |
80 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type); | 82 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type); |
81 return WebString::fromUTF8(mime_type); | 83 return WebString::fromUTF8(mime_type); |
82 } | 84 } |
83 | 85 |
84 WebString SimpleWebMimeRegistryImpl::wellKnownMimeTypeForExtension( | 86 WebString SimpleWebMimeRegistryImpl::wellKnownMimeTypeForExtension( |
85 const WebString& file_extension) { | 87 const WebString& file_extension) { |
86 std::string mime_type; | 88 std::string mime_type; |
87 net::GetWellKnownMimeTypeFromExtension( | 89 net::GetWellKnownMimeTypeFromExtension( |
88 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type); | 90 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type); |
89 return WebString::fromUTF8(mime_type); | 91 return WebString::fromUTF8(mime_type); |
90 } | 92 } |
91 | 93 |
92 WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile( | 94 WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile( |
93 const WebString& file_path) { | 95 const WebString& file_path) { |
94 std::string mime_type; | 96 std::string mime_type; |
95 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path), | 97 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path), |
96 &mime_type); | 98 &mime_type); |
97 return WebString::fromUTF8(mime_type); | 99 return WebString::fromUTF8(mime_type); |
98 } | 100 } |
99 | 101 |
100 } // namespace content | 102 } // namespace content |
OLD | NEW |