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

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

Issue 17101027: Add a function to convert key system into UUID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits 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 "webkit/renderer/media/crypto/key_systems_info.h" 5 #include "webkit/renderer/media/crypto/key_systems_info.h"
6 6
7 #include "base/basictypes.h"
8
9 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 7 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
10 8
11 #if defined(WIDEVINE_CDM_AVAILABLE) && \ 9 #if defined(WIDEVINE_CDM_AVAILABLE) && \
12 defined(OS_LINUX) && !defined(OS_CHROMEOS) 10 defined(OS_LINUX) && !defined(OS_CHROMEOS)
13 #include <gnu/libc-version.h> 11 #include <gnu/libc-version.h>
14 #include "base/logging.h" 12 #include "base/logging.h"
15 #include "base/version.h" 13 #include "base/version.h"
16 #endif 14 #endif
17 15
18 namespace webkit_media { 16 namespace webkit_media {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 { kExternalClearKeyKeySystem, "application/x-ppapi-clearkey-cdm"}, 92 { kExternalClearKeyKeySystem, "application/x-ppapi-clearkey-cdm"},
95 #if defined(WIDEVINE_CDM_AVAILABLE) 93 #if defined(WIDEVINE_CDM_AVAILABLE)
96 { kWidevineKeySystem, kWidevineCdmPluginMimeType} 94 { kWidevineKeySystem, kWidevineCdmPluginMimeType}
97 #endif // WIDEVINE_CDM_AVAILABLE 95 #endif // WIDEVINE_CDM_AVAILABLE
98 }; 96 };
99 97
100 const int kNumKeySystemToPepperTypeMapping = 98 const int kNumKeySystemToPepperTypeMapping =
101 arraysize(kKeySystemToPepperTypeMapping); 99 arraysize(kKeySystemToPepperTypeMapping);
102 #endif // defined(ENABLE_PEPPER_CDMS) 100 #endif // defined(ENABLE_PEPPER_CDMS)
103 101
102 #if defined(OS_ANDROID)
103 // TODO(qinmin): add UUIDs for other key systems.
ddorwin 2013/06/20 22:20:15 You could (should?) also ifdef this with WIDEVINE_
qinmin 2013/06/20 23:30:12 Done.
104 static const uint8 kWideVineUUID[] = {
105 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE,
106 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED
107 };
108
109 const KeySystemUUIDPair kKeySystemToUUIDMapping[] = {
110 { "com.widevine.alpha",
111 std::vector<uint8>(kWideVineUUID, kWideVineUUID + 16) }
ddorwin 2013/06/20 22:20:15 Static initialization of complex type is not allow
qinmin 2013/06/20 23:30:12 Done.
112 };
113
114 const int kNumKeySystemToUUIDMapping =
115 arraysize(kKeySystemToUUIDMapping);
ddorwin 2013/06/20 22:20:15 fits
qinmin 2013/06/20 23:30:12 Done.
116 #endif // defined(OS_ANDROID)
117
104 bool IsSystemCompatible(const std::string& key_system) { 118 bool IsSystemCompatible(const std::string& key_system) {
105 #if defined(WIDEVINE_CDM_AVAILABLE) && \ 119 #if defined(WIDEVINE_CDM_AVAILABLE) && \
106 defined(OS_LINUX) && !defined(OS_CHROMEOS) 120 defined(OS_LINUX) && !defined(OS_CHROMEOS)
107 if (key_system == kWidevineKeySystem || 121 if (key_system == kWidevineKeySystem ||
108 key_system == kWidevineBaseKeySystem) { 122 key_system == kWidevineBaseKeySystem) {
109 Version glibc_version(gnu_get_libc_version()); 123 Version glibc_version(gnu_get_libc_version());
110 DCHECK(glibc_version.IsValid()); 124 DCHECK(glibc_version.IsValid());
111 return !glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION); 125 return !glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION);
112 } 126 }
113 #endif 127 #endif
114 return true; 128 return true;
115 } 129 }
116 130
117 std::string KeySystemNameForUMAGeneric(const std::string& key_system) { 131 std::string KeySystemNameForUMAGeneric(const std::string& key_system) {
118 if (key_system == kClearKeyKeySystem) 132 if (key_system == kClearKeyKeySystem)
119 return "ClearKey"; 133 return "ClearKey";
120 #if defined(WIDEVINE_CDM_AVAILABLE) 134 #if defined(WIDEVINE_CDM_AVAILABLE)
121 if (key_system == kWidevineKeySystem) 135 if (key_system == kWidevineKeySystem)
122 return "Widevine"; 136 return "Widevine";
123 #endif // WIDEVINE_CDM_AVAILABLE 137 #endif // WIDEVINE_CDM_AVAILABLE
124 return "Unknown"; 138 return "Unknown";
125 } 139 }
126 140
127 bool CanUseBuiltInAesDecryptor(const std::string& key_system) { 141 bool CanUseBuiltInAesDecryptor(const std::string& key_system) {
128 return key_system == kClearKeyKeySystem; 142 return key_system == kClearKeyKeySystem;
129 } 143 }
130 144
131 } // namespace webkit_media 145 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698