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

Side by Side Diff: net/base/mime_util.cc

Issue 17447011: Shuffle media-related WebMimeRegistry code from webkit/ to content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 <algorithm> 5 #include <algorithm>
6 #include <iterator> 6 #include <iterator>
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 927
928 GetExtensionsFromHardCodedMappings(secondary_mappings, 928 GetExtensionsFromHardCodedMappings(secondary_mappings,
929 arraysize(secondary_mappings), 929 arraysize(secondary_mappings),
930 mime_type, 930 mime_type,
931 &unique_extensions); 931 &unique_extensions);
932 } 932 }
933 933
934 HashSetToVector(&unique_extensions, extensions); 934 HashSetToVector(&unique_extensions, extensions);
935 } 935 }
936 936
937 void GetMediaTypesBlacklistedForTests(std::vector<std::string>* types) {
938 types->clear();
939
940 // Unless/until WebM files are added to the media layout tests, we need to avoid
941 // blacklisting mp4 and H.264 when Theora is not supported (and proprietary
942 // codecs are) so that the media tests can still run.
943 #if defined(ENABLE_MEDIA_CODEC_THEORA) || !defined(USE_PROPRIETARY_CODECS)
944 for (size_t i = 0; i < arraysize(proprietary_media_types); ++i)
945 types->push_back(proprietary_media_types[i]);
946 #endif
947 }
948
949 void GetMediaCodecsBlacklistedForTests(std::vector<std::string>* codecs) {
950 codecs->clear();
951
952 // Unless/until WebM files are added to the media layout tests, we need to avoid
953 // blacklisting mp4 and H.264 when Theora is not supported (and proprietary
954 // codecs are) so that the media tests can still run.
955 #if defined(ENABLE_MEDIA_CODEC_THEORA) || !defined(USE_PROPRIETARY_CODECS)
956 for (size_t i = 0; i < arraysize(proprietary_media_codecs); ++i)
957 codecs->push_back(proprietary_media_codecs[i]);
958 #endif
959 }
960
961 const std::string GetIANAMediaType(const std::string& mime_type) { 937 const std::string GetIANAMediaType(const std::string& mime_type) {
962 for (size_t i = 0; i < arraysize(kIanaMediaTypes); ++i) { 938 for (size_t i = 0; i < arraysize(kIanaMediaTypes); ++i) {
963 if (StartsWithASCII(mime_type, kIanaMediaTypes[i].matcher, true)) { 939 if (StartsWithASCII(mime_type, kIanaMediaTypes[i].matcher, true)) {
964 return kIanaMediaTypes[i].name; 940 return kIanaMediaTypes[i].name;
965 } 941 }
966 } 942 }
967 return std::string(); 943 return std::string();
968 } 944 }
969 945
970 CertificateMimeType GetCertificateMimeTypeForMimeType( 946 CertificateMimeType GetCertificateMimeTypeForMimeType(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 post_data->append("\r\n" + value + "\r\n"); 979 post_data->append("\r\n" + value + "\r\n");
1004 } 980 }
1005 981
1006 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, 982 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary,
1007 std::string* post_data) { 983 std::string* post_data) {
1008 DCHECK(post_data); 984 DCHECK(post_data);
1009 post_data->append("--" + mime_boundary + "--\r\n"); 985 post_data->append("--" + mime_boundary + "--\r\n");
1010 } 986 }
1011 987
1012 } // namespace net 988 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698