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

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

Issue 228823003: Adding check for MIME types that do not take codecs parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changing AreSupportedCodecs Created 6 years, 8 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
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | net/base/mime_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 const char* codecs_list; 431 const char* codecs_list;
432 }; 432 };
433 433
434 static const MediaFormatStrict format_codec_mappings[] = { 434 static const MediaFormatStrict format_codec_mappings[] = {
435 { "video/webm", "opus,vorbis,vp8,vp8.0,vp9,vp9.0" }, 435 { "video/webm", "opus,vorbis,vp8,vp8.0,vp9,vp9.0" },
436 { "audio/webm", "opus,vorbis" }, 436 { "audio/webm", "opus,vorbis" },
437 { "audio/wav", "1" }, 437 { "audio/wav", "1" },
438 { "audio/x-wav", "1" }, 438 { "audio/x-wav", "1" },
439 { "video/ogg", "opus,theora,vorbis" }, 439 { "video/ogg", "opus,theora,vorbis" },
440 { "audio/ogg", "opus,vorbis" }, 440 { "audio/ogg", "opus,vorbis" },
441 { "application/ogg", "opus,theora,vorbis" } 441 { "application/ogg", "opus,theora,vorbis" },
442 { "audio/mpeg", "" },
443 { "audio/mp3", "" },
444 { "audio/x-mp3", "" }
442 }; 445 };
443 446
444 MimeUtil::MimeUtil() { 447 MimeUtil::MimeUtil() {
445 InitializeMimeTypeMaps(); 448 InitializeMimeTypeMaps();
446 } 449 }
447 450
448 // static 451 // static
449 bool MimeUtil::AreSupportedCodecs(const MimeMappings& supported_codecs, 452 bool MimeUtil::AreSupportedCodecs(const MimeMappings& supported_codecs,
450 const std::vector<std::string>& codecs) { 453 const std::vector<std::string>& codecs) {
454 if (supported_codecs.empty())
455 return codecs.empty();
456
451 for (size_t i = 0; i < codecs.size(); ++i) { 457 for (size_t i = 0; i < codecs.size(); ++i) {
452 if (supported_codecs.find(codecs[i]) == supported_codecs.end()) 458 if (supported_codecs.find(codecs[i]) == supported_codecs.end())
453 return false; 459 return false;
454 } 460 }
455 return !codecs.empty(); 461 return !codecs.empty();
456 } 462 }
457 463
458 void MimeUtil::InitializeMimeTypeMaps() { 464 void MimeUtil::InitializeMimeTypeMaps() {
459 for (size_t i = 0; i < arraysize(supported_image_types); ++i) 465 for (size_t i = 0; i < arraysize(supported_image_types); ++i)
460 image_map_.insert(supported_image_types[i]); 466 image_map_.insert(supported_image_types[i]);
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 post_data->append("\r\n" + value + "\r\n"); 1034 post_data->append("\r\n" + value + "\r\n");
1029 } 1035 }
1030 1036
1031 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, 1037 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary,
1032 std::string* post_data) { 1038 std::string* post_data) {
1033 DCHECK(post_data); 1039 DCHECK(post_data);
1034 post_data->append("--" + mime_boundary + "--\r\n"); 1040 post_data->append("--" + mime_boundary + "--\r\n");
1035 } 1041 }
1036 1042
1037 } // namespace net 1043 } // namespace net
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | net/base/mime_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698