| 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 "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 "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/mime_util.h" | 10 #include "net/base/mime_util.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 12 #include "webkit/glue/webkit_glue.h" | 12 #include "webkit/glue/webkit_glue.h" |
| 13 #include "webkit/media/key_systems.h" | 13 #include "webkit/media/crypto/key_systems.h" |
| 14 | 14 |
| 15 using WebKit::WebString; | 15 using WebKit::WebString; |
| 16 using WebKit::WebMimeRegistry; | 16 using WebKit::WebMimeRegistry; |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Convert a WebString to ASCII, falling back on an empty string in the case | 20 // Convert a WebString to ASCII, falling back on an empty string in the case |
| 21 // of a non-ASCII string. | 21 // of a non-ASCII string. |
| 22 std::string ToASCIIOrEmpty(const WebString& string) { | 22 std::string ToASCIIOrEmpty(const WebString& string) { |
| 23 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); | 23 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 WebString SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType( | 139 WebString SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType( |
| 140 const WebString& mime_type) { | 140 const WebString& mime_type) { |
| 141 FilePath::StringType file_extension; | 141 FilePath::StringType file_extension; |
| 142 net::GetPreferredExtensionForMimeType(ToASCIIOrEmpty(mime_type), | 142 net::GetPreferredExtensionForMimeType(ToASCIIOrEmpty(mime_type), |
| 143 &file_extension); | 143 &file_extension); |
| 144 return FilePathStringToWebString(file_extension); | 144 return FilePathStringToWebString(file_extension); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace webkit_glue | 147 } // namespace webkit_glue |
| OLD | NEW |