| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 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 "third_party/WebKit/WebKit/chromium/public/WebString.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
| 11 #include "webkit/glue/webkit_glue.h" | 11 #include "webkit/glue/webkit_glue.h" |
| 12 | 12 |
| 13 using WebKit::WebString; | 13 using WebKit::WebString; |
| 14 using WebKit::WebMimeRegistry; | 14 using WebKit::WebMimeRegistry; |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // Convert a WebString to ASCII, falling back on an empty string in the case | 18 // Convert a WebString to ASCII, falling back on an empty string in the case |
| 19 // of a non-ASCII string. | 19 // of a non-ASCII string. |
| 20 std::string AsASCII(const WebString& string) { | 20 std::string AsASCII(const WebString& string) { |
| 21 if (!IsStringASCII(string)) | 21 if (!IsStringASCII(string)) |
| 22 return EmptyString(); | 22 return std::string(); |
| 23 return UTF16ToASCII(string); | 23 return UTF16ToASCII(string); |
| 24 } | 24 } |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 namespace webkit_glue { | 28 namespace webkit_glue { |
| 29 | 29 |
| 30 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMIMEType( | 30 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMIMEType( |
| 31 const WebString& mime_type) { | 31 const WebString& mime_type) { |
| 32 if (!net::IsSupportedMimeType(AsASCII(mime_type).c_str())) | 32 if (!net::IsSupportedMimeType(AsASCII(mime_type).c_str())) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 WebString SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType( | 90 WebString SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType( |
| 91 const WebString& mime_type) { | 91 const WebString& mime_type) { |
| 92 FilePath::StringType file_extension; | 92 FilePath::StringType file_extension; |
| 93 net::GetPreferredExtensionForMimeType(AsASCII(mime_type), | 93 net::GetPreferredExtensionForMimeType(AsASCII(mime_type), |
| 94 &file_extension); | 94 &file_extension); |
| 95 return FilePathStringToWebString(file_extension); | 95 return FilePathStringToWebString(file_extension); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace webkit_glue | 98 } // namespace webkit_glue |
| OLD | NEW |