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

Side by Side Diff: webkit/media/crypto/key_systems.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webclipboard_impl.cc ('k') | webkit/media/crypto/key_systems_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 <map> 5 #include <map>
6 6
7 #include "webkit/media/crypto/key_systems.h" 7 #include "webkit/media/crypto/key_systems.h"
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 kSupportedFormatKeySystemCombinations[i]; 59 kSupportedFormatKeySystemCombinations[i];
60 std::vector<std::string> mime_type_codecs; 60 std::vector<std::string> mime_type_codecs;
61 net::ParseCodecString(combination.codecs_list, 61 net::ParseCodecString(combination.codecs_list,
62 &mime_type_codecs, 62 &mime_type_codecs,
63 false); 63 false);
64 64
65 CodecMappings codecs; 65 CodecMappings codecs;
66 for (size_t j = 0; j < mime_type_codecs.size(); ++j) 66 for (size_t j = 0; j < mime_type_codecs.size(); ++j)
67 codecs.insert(mime_type_codecs[j]); 67 codecs.insert(mime_type_codecs[j]);
68 // Support the MIME type string alone, without codec(s) specified. 68 // Support the MIME type string alone, without codec(s) specified.
69 codecs.insert(""); 69 codecs.insert(std::string());
70 70
71 // Key systems can be repeated, so there may already be an entry. 71 // Key systems can be repeated, so there may already be an entry.
72 KeySystemMappings::iterator key_system_iter = 72 KeySystemMappings::iterator key_system_iter =
73 key_system_map_.find(combination.key_system); 73 key_system_map_.find(combination.key_system);
74 if (key_system_iter == key_system_map_.end()) { 74 if (key_system_iter == key_system_map_.end()) {
75 MimeTypeMappings mime_types_map; 75 MimeTypeMappings mime_types_map;
76 mime_types_map[combination.mime_type] = codecs; 76 mime_types_map[combination.mime_type] = codecs;
77 key_system_map_[combination.key_system] = mime_types_map; 77 key_system_map_[combination.key_system] = mime_types_map;
78 } else { 78 } else {
79 MimeTypeMappings& mime_types_map = key_system_iter->second; 79 MimeTypeMappings& mime_types_map = key_system_iter->second;
(...skipping 26 matching lines...) Expand all
106 106
107 const CodecMappings& codecs = mime_iter->second; 107 const CodecMappings& codecs = mime_iter->second;
108 return (codecs.find(codec) != codecs.end()) && IsSystemCompatible(key_system); 108 return (codecs.find(codec) != codecs.end()) && IsSystemCompatible(key_system);
109 } 109 }
110 110
111 bool KeySystems::IsSupportedKeySystemWithMediaMimeType( 111 bool KeySystems::IsSupportedKeySystemWithMediaMimeType(
112 const std::string& mime_type, 112 const std::string& mime_type,
113 const std::vector<std::string>& codecs, 113 const std::vector<std::string>& codecs,
114 const std::string& key_system) { 114 const std::string& key_system) {
115 if (codecs.empty()) 115 if (codecs.empty())
116 return IsSupportedKeySystemWithContainerAndCodec(mime_type, "", key_system); 116 return IsSupportedKeySystemWithContainerAndCodec(
117 mime_type, std::string(), key_system);
117 118
118 for (size_t i = 0; i < codecs.size(); ++i) { 119 for (size_t i = 0; i < codecs.size(); ++i) {
119 if (!IsSupportedKeySystemWithContainerAndCodec( 120 if (!IsSupportedKeySystemWithContainerAndCodec(
120 mime_type, codecs[i], key_system)) 121 mime_type, codecs[i], key_system))
121 return false; 122 return false;
122 } 123 }
123 124
124 return true; 125 return true;
125 } 126 }
126 127
(...skipping 24 matching lines...) Expand all
151 std::string GetPluginType(const std::string& key_system) { 152 std::string GetPluginType(const std::string& key_system) {
152 for (int i = 0; i < kNumKeySystemToPluginTypeMapping; ++i) { 153 for (int i = 0; i < kNumKeySystemToPluginTypeMapping; ++i) {
153 if (kKeySystemToPluginTypeMapping[i].key_system == key_system) 154 if (kKeySystemToPluginTypeMapping[i].key_system == key_system)
154 return kKeySystemToPluginTypeMapping[i].plugin_type; 155 return kKeySystemToPluginTypeMapping[i].plugin_type;
155 } 156 }
156 157
157 return std::string(); 158 return std::string();
158 } 159 }
159 160
160 } // namespace webkit_media 161 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/glue/webclipboard_impl.cc ('k') | webkit/media/crypto/key_systems_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698