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

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

Issue 1274123003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no media changes Created 5 years, 4 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 | « gpu/config/gpu_util.cc ('k') | media/filters/chunk_demuxer_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 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
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_ALL);
423
424 // Convert empty or all-whitespace input to 0 results.
425 if (codecs_out->size() == 1 && (*codecs_out)[0].empty())
426 codecs_out->clear();
423 427
424 if (!strip) 428 if (!strip)
425 return; 429 return;
426 430
427 // Strip everything past the first '.' 431 // Strip everything past the first '.'
428 for (std::vector<std::string>::iterator it = codecs_out->begin(); 432 for (std::vector<std::string>::iterator it = codecs_out->begin();
429 it != codecs_out->end(); 433 it != codecs_out->end();
430 ++it) { 434 ++it) {
431 size_t found = it->find_first_of('.'); 435 size_t found = it->find_first_of('.');
432 if (found != std::string::npos) 436 if (found != std::string::npos)
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 std::vector<std::string>* codecs_out, 652 std::vector<std::string>* codecs_out,
649 const bool strip) { 653 const bool strip) {
650 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip); 654 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip);
651 } 655 }
652 656
653 void RemoveProprietaryMediaTypesAndCodecsForTests() { 657 void RemoveProprietaryMediaTypesAndCodecsForTests() {
654 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests(); 658 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests();
655 } 659 }
656 660
657 } // namespace media 661 } // namespace media
OLDNEW
« no previous file with comments | « gpu/config/gpu_util.cc ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698