| 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 "mojo/services/html_viewer/webmimeregistry_impl.h" | 5 #include "mojo/services/html_viewer/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" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 blink::WebMimeRegistry::SupportsType | 104 blink::WebMimeRegistry::SupportsType |
| 105 WebMimeRegistryImpl::supportsNonImageMIMEType( | 105 WebMimeRegistryImpl::supportsNonImageMIMEType( |
| 106 const blink::WebString& mime_type) { | 106 const blink::WebString& mime_type) { |
| 107 return net::IsSupportedNonImageMimeType(ToASCIIOrEmpty(mime_type)) ? | 107 return net::IsSupportedNonImageMimeType(ToASCIIOrEmpty(mime_type)) ? |
| 108 blink::WebMimeRegistry::IsSupported : | 108 blink::WebMimeRegistry::IsSupported : |
| 109 blink::WebMimeRegistry::IsNotSupported; | 109 blink::WebMimeRegistry::IsNotSupported; |
| 110 } | 110 } |
| 111 | 111 |
| 112 blink::WebString WebMimeRegistryImpl::mimeTypeForExtension( | 112 blink::WebString WebMimeRegistryImpl::mimeTypeForExtension( |
| 113 const blink::WebString& file_extension) { | 113 const blink::WebString& file_extension) { |
| 114 NOTIMPLEMENTED(); | 114 std::string mime_type; |
| 115 return blink::WebString(); | 115 net::GetMimeTypeFromExtension( |
| 116 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type); |
| 117 return blink::WebString::fromUTF8(mime_type); |
| 116 } | 118 } |
| 117 | 119 |
| 118 blink::WebString WebMimeRegistryImpl::wellKnownMimeTypeForExtension( | 120 blink::WebString WebMimeRegistryImpl::wellKnownMimeTypeForExtension( |
| 119 const blink::WebString& file_extension) { | 121 const blink::WebString& file_extension) { |
| 120 NOTIMPLEMENTED(); | 122 std::string mime_type; |
| 121 return blink::WebString(); | 123 net::GetWellKnownMimeTypeFromExtension( |
| 124 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type); |
| 125 return blink::WebString::fromUTF8(mime_type); |
| 122 } | 126 } |
| 123 | 127 |
| 124 blink::WebString WebMimeRegistryImpl::mimeTypeFromFile( | 128 blink::WebString WebMimeRegistryImpl::mimeTypeFromFile( |
| 125 const blink::WebString& file_path) { | 129 const blink::WebString& file_path) { |
| 126 NOTIMPLEMENTED(); | 130 std::string mime_type; |
| 127 return blink::WebString(); | 131 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path), |
| 132 &mime_type); |
| 133 return blink::WebString::fromUTF8(mime_type); |
| 128 } | 134 } |
| 129 | 135 |
| 130 } // namespace html_viewer | 136 } // namespace html_viewer |
| OLD | NEW |