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

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

Issue 1272823003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/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 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_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
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
OLDNEW
« no previous file with comments | « gpu/config/gpu_util.cc ('k') | media/base/mime_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698