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

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

Issue 17101027: Add a function to convert key system into UUID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing ddorwin's comments Created 7 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/media/crypto/key_systems.h" 7 #include "webkit/renderer/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"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "net/base/mime_util.h" 12 #include "net/base/mime_util.h"
13 #include "third_party/WebKit/public/platform/WebCString.h" 13 #include "third_party/WebKit/public/platform/WebCString.h"
14 #include "third_party/WebKit/public/platform/WebString.h" 14 #include "third_party/WebKit/public/platform/WebString.h"
15 #include "webkit/renderer/media/crypto/key_systems_info.h" 15 #include "webkit/renderer/media/crypto/key_systems_info.h"
16 16
ddorwin 2013/06/20 03:07:27 All the system specifics go in key_systems_info.h/
qinmin 2013/06/20 17:41:53 Done.
17 namespace {
18
19 // TODO(qinmin): add UUIDs for other key systems.
ddorwin 2013/06/20 03:07:27 #ifdef all the new code to Android
qinmin 2013/06/20 17:41:53 Done.
20 const uint8 kWideVineUUID[] = {
ddorwin 2013/06/20 03:07:27 nit: media code uses static instead of unnamed nam
qinmin 2013/06/20 17:41:53 Done.
21 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE,
22 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED,
xhwang 2013/06/20 04:02:08 nit: drop the last comma.
qinmin 2013/06/20 17:41:53 Done.
23 };
24
25 } // namespace
26
17 namespace webkit_media { 27 namespace webkit_media {
18 28
19 // Convert a WebString to ASCII, falling back on an empty string in the case 29 // Convert a WebString to ASCII, falling back on an empty string in the case
20 // of a non-ASCII string. 30 // of a non-ASCII string.
21 static std::string ToASCIIOrEmpty(const WebKit::WebString& string) { 31 static std::string ToASCIIOrEmpty(const WebKit::WebString& string) {
22 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); 32 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string();
23 } 33 }
24 34
25 class KeySystems { 35 class KeySystems {
26 public: 36 public:
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 std::string GetPepperType(const std::string& key_system) { 163 std::string GetPepperType(const std::string& key_system) {
154 for (int i = 0; i < kNumKeySystemToPepperTypeMapping; ++i) { 164 for (int i = 0; i < kNumKeySystemToPepperTypeMapping; ++i) {
155 if (kKeySystemToPepperTypeMapping[i].key_system == key_system) 165 if (kKeySystemToPepperTypeMapping[i].key_system == key_system)
156 return kKeySystemToPepperTypeMapping[i].type; 166 return kKeySystemToPepperTypeMapping[i].type;
157 } 167 }
158 168
159 return std::string(); 169 return std::string();
160 } 170 }
161 #endif // defined(ENABLE_PEPPER_CDMS) 171 #endif // defined(ENABLE_PEPPER_CDMS)
162 172
173 std::vector<uint8> ConvertKeySystemToAndroidUUID(
ddorwin 2013/06/20 03:07:27 nit: Updating my previous suggesetion, GetAndroidU
xhwang 2013/06/20 04:02:08 I wonder whats' the extent of this UUID? Is this o
ddorwin 2013/06/20 04:12:44 Good point about GetPepperType(). I'm fine with Ge
qinmin 2013/06/20 17:41:53 Done.
174 const std::string& key_system) {
175 std::vector<uint8> uuid;
176 if (key_system == "com.widevine.alpha")
ddorwin 2013/06/20 03:07:27 There is a constant for this in the _info file.
qinmin 2013/06/20 17:41:53 Seems that I need defined(WIDEVINE_CDM_AVAILABLE)
ddorwin 2013/06/20 22:20:15 Yes. That currently does two things for non-Pepper
177 uuid.assign(kWideVineUUID, kWideVineUUID + 16);
178 else
179 LOG(ERROR) << "Unrecognized key system: " << key_system;
180 return uuid;
181 }
182
163 } // namespace webkit_media 183 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698