OLD | NEW |
---|---|
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 Loading... | |
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. | |
104 const KeySystemUUIDPair kKeySystemToUUIDMapping[] = { | |
105 #if defined(WIDEVINE_CDM_AVAILABLE) | |
106 { kWidevineKeySystem, { 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, | |
107 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED } | |
108 } | |
109 #endif // defined(WIDEVINE_CDM_AVAILABLE) | |
110 }; | |
111 | |
112 // arraySize() does not work if the array is empty, use ARRAYSIZE_UNSAFE() | |
ddorwin
2013/06/20 23:50:12
... so use ARRAYSIZE_UNSAFE().
^ might fit
qinmin
2013/06/20 23:54:52
Done.
| |
113 // instead. | |
114 const int kNumKeySystemToUUIDMapping = | |
115 ARRAYSIZE_UNSAFE(kKeySystemToUUIDMapping); | |
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 |
OLD | NEW |