Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: webkit/glue/simple_webmimeregistry_impl.cc

Issue 17447011: Shuffle media-related WebMimeRegistry code from webkit/ to content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "media/filters/stream_parser_factory.h" 10 #include "media/filters/stream_parser_factory.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 #include "webkit/base/file_path_string_conversions.h" 13 #include "webkit/base/file_path_string_conversions.h"
14 #include "webkit/renderer/media/crypto/key_systems.h" 14 #include "webkit/renderer/media/crypto/key_systems.h"
15 15
16 using WebKit::WebString; 16 using WebKit::WebString;
17 using WebKit::WebMimeRegistry; 17 using WebKit::WebMimeRegistry;
18 18
19 namespace { 19 namespace webkit_glue {
20 20
21 // Convert a WebString to ASCII, falling back on an empty string in the case 21 //static
22 // of a non-ASCII string. 22 std::string SimpleWebMimeRegistryImpl::ToASCIIOrEmpty(const WebString& string) {
23 std::string ToASCIIOrEmpty(const WebString& string) {
24 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); 23 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string();
25 } 24 }
26 25
27 } // namespace
28
29 namespace webkit_glue {
30
31 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMIMEType( 26 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMIMEType(
32 const WebString& mime_type) { 27 const WebString& mime_type) {
33 return net::IsSupportedMimeType(ToASCIIOrEmpty(mime_type)) ? 28 return net::IsSupportedMimeType(ToASCIIOrEmpty(mime_type)) ?
34 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; 29 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported;
35 } 30 }
36 31
37 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsImageMIMEType( 32 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsImageMIMEType(
38 const WebString& mime_type) { 33 const WebString& mime_type) {
39 return net::IsSupportedImageMimeType(ToASCIIOrEmpty(mime_type)) ? 34 return net::IsSupportedImageMimeType(ToASCIIOrEmpty(mime_type)) ?
40 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; 35 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 147
153 WebString SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType( 148 WebString SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType(
154 const WebString& mime_type) { 149 const WebString& mime_type) {
155 base::FilePath::StringType file_extension; 150 base::FilePath::StringType file_extension;
156 net::GetPreferredExtensionForMimeType(ToASCIIOrEmpty(mime_type), 151 net::GetPreferredExtensionForMimeType(ToASCIIOrEmpty(mime_type),
157 &file_extension); 152 &file_extension);
158 return webkit_base::FilePathStringToWebString(file_extension); 153 return webkit_base::FilePathStringToWebString(file_extension);
159 } 154 }
160 155
161 } // namespace webkit_glue 156 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698