OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 !IsCodecSupported(codec)) { | 410 !IsCodecSupported(codec)) { |
411 return false; | 411 return false; |
412 } | 412 } |
413 } | 413 } |
414 return true; | 414 return true; |
415 } | 415 } |
416 | 416 |
417 void MimeUtil::ParseCodecString(const std::string& codecs, | 417 void MimeUtil::ParseCodecString(const std::string& codecs, |
418 std::vector<std::string>* codecs_out, | 418 std::vector<std::string>* codecs_out, |
419 bool strip) { | 419 bool strip) { |
420 std::string no_quote_codecs; | 420 *codecs_out = base::SplitString( |
421 base::TrimString(codecs, "\"", &no_quote_codecs); | 421 base::TrimString(codecs, "\"", base::TRIM_ALL), |
422 base::SplitString(no_quote_codecs, ',', codecs_out); | 422 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
423 | 423 |
424 if (!strip) | 424 if (!strip) |
425 return; | 425 return; |
426 | 426 |
427 // Strip everything past the first '.' | 427 // Strip everything past the first '.' |
428 for (std::vector<std::string>::iterator it = codecs_out->begin(); | 428 for (std::vector<std::string>::iterator it = codecs_out->begin(); |
429 it != codecs_out->end(); | 429 it != codecs_out->end(); |
430 ++it) { | 430 ++it) { |
431 size_t found = it->find_first_of('.'); | 431 size_t found = it->find_first_of('.'); |
432 if (found != std::string::npos) | 432 if (found != std::string::npos) |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 std::vector<std::string>* codecs_out, | 649 std::vector<std::string>* codecs_out, |
650 const bool strip) { | 650 const bool strip) { |
651 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip); | 651 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip); |
652 } | 652 } |
653 | 653 |
654 void RemoveProprietaryMediaTypesAndCodecsForTests() { | 654 void RemoveProprietaryMediaTypesAndCodecsForTests() { |
655 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests(); | 655 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests(); |
656 } | 656 } |
657 | 657 |
658 } // namespace media | 658 } // namespace media |
OLD | NEW |