OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include "webkit/glue/simple_webmimeregistry_impl.h" | 5 #include "webkit/glue/simple_webmimeregistry_impl.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "net/base/mime_util.h" | 9 #include "net/base/mime_util.h" |
10 #include "webkit/api/public/WebString.h" | 10 #include "webkit/api/public/WebString.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 std::string AsASCII(const WebString& string) { | 21 std::string AsASCII(const WebString& string) { |
22 if (!IsStringASCII(string)) | 22 if (!IsStringASCII(string)) |
23 return EmptyString(); | 23 return EmptyString(); |
24 return UTF16ToASCII(string); | 24 return UTF16ToASCII(string); |
25 } | 25 } |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 namespace webkit_glue { | 29 namespace webkit_glue { |
30 | 30 |
| 31 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMIMEType( |
| 32 const WebString& mime_type) { |
| 33 if (!net::IsSupportedMimeType(AsASCII(mime_type).c_str())) |
| 34 return WebMimeRegistry::IsNotSupported; |
| 35 return WebMimeRegistry::IsSupported; |
| 36 } |
| 37 |
31 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsImageMIMEType( | 38 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsImageMIMEType( |
32 const WebString& mime_type) { | 39 const WebString& mime_type) { |
33 if (!net::IsSupportedImageMimeType(AsASCII(mime_type).c_str())) | 40 if (!net::IsSupportedImageMimeType(AsASCII(mime_type).c_str())) |
34 return WebMimeRegistry::IsNotSupported; | 41 return WebMimeRegistry::IsNotSupported; |
35 return WebMimeRegistry::IsSupported; | 42 return WebMimeRegistry::IsSupported; |
36 } | 43 } |
37 | 44 |
38 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsJavaScriptMIMET
ype( | 45 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsJavaScriptMIMET
ype( |
39 const WebString& mime_type) { | 46 const WebString& mime_type) { |
40 if (!net::IsSupportedJavascriptMimeType(AsASCII(mime_type).c_str())) | 47 if (!net::IsSupportedJavascriptMimeType(AsASCII(mime_type).c_str())) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 90 |
84 WebString SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType( | 91 WebString SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType( |
85 const WebString& mime_type) { | 92 const WebString& mime_type) { |
86 FilePath::StringType file_extension; | 93 FilePath::StringType file_extension; |
87 net::GetPreferredExtensionForMimeType(AsASCII(mime_type), | 94 net::GetPreferredExtensionForMimeType(AsASCII(mime_type), |
88 &file_extension); | 95 &file_extension); |
89 return FilePathStringToWebString(file_extension); | 96 return FilePathStringToWebString(file_extension); |
90 } | 97 } |
91 | 98 |
92 } // namespace webkit_glue | 99 } // namespace webkit_glue |
OLD | NEW |