| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/glue/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 "net/base/mime_util.h" | 11 #include "net/base/mime_util.h" |
| 12 #include "third_party/WebKit/public/platform/WebString.h" | 12 #include "third_party/WebKit/public/platform/WebString.h" |
| 13 | 13 |
| 14 using blink::WebString; | 14 using blink::WebString; |
| 15 using blink::WebMimeRegistry; | 15 using blink::WebMimeRegistry; |
| 16 | 16 |
| 17 namespace webkit_glue { | 17 namespace content { |
| 18 | 18 |
| 19 //static | 19 //static |
| 20 std::string SimpleWebMimeRegistryImpl::ToASCIIOrEmpty(const WebString& string) { | 20 std::string SimpleWebMimeRegistryImpl::ToASCIIOrEmpty(const WebString& string) { |
| 21 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); | 21 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMIMEType( | 24 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMIMEType( |
| 25 const WebString& mime_type) { | 25 const WebString& mime_type) { |
| 26 return net::IsSupportedMimeType(ToASCIIOrEmpty(mime_type)) ? | 26 return net::IsSupportedMimeType(ToASCIIOrEmpty(mime_type)) ? |
| 27 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; | 27 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile( | 83 WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile( |
| 84 const WebString& file_path) { | 84 const WebString& file_path) { |
| 85 std::string mime_type; | 85 std::string mime_type; |
| 86 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path), | 86 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path), |
| 87 &mime_type); | 87 &mime_type); |
| 88 return WebString::fromUTF8(mime_type); | 88 return WebString::fromUTF8(mime_type); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace webkit_glue | 91 } // namespace content |
| OLD | NEW |