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, so use ARRAYSIZE_UNSAFE(). |
| 113 const int kNumKeySystemToUUIDMapping = |
| 114 ARRAYSIZE_UNSAFE(kKeySystemToUUIDMapping); |
| 115 #endif // defined(OS_ANDROID) |
| 116 |
104 bool IsSystemCompatible(const std::string& key_system) { | 117 bool IsSystemCompatible(const std::string& key_system) { |
105 #if defined(WIDEVINE_CDM_AVAILABLE) && \ | 118 #if defined(WIDEVINE_CDM_AVAILABLE) && \ |
106 defined(OS_LINUX) && !defined(OS_CHROMEOS) | 119 defined(OS_LINUX) && !defined(OS_CHROMEOS) |
107 if (key_system == kWidevineKeySystem || | 120 if (key_system == kWidevineKeySystem || |
108 key_system == kWidevineBaseKeySystem) { | 121 key_system == kWidevineBaseKeySystem) { |
109 Version glibc_version(gnu_get_libc_version()); | 122 Version glibc_version(gnu_get_libc_version()); |
110 DCHECK(glibc_version.IsValid()); | 123 DCHECK(glibc_version.IsValid()); |
111 return !glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION); | 124 return !glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION); |
112 } | 125 } |
113 #endif | 126 #endif |
114 return true; | 127 return true; |
115 } | 128 } |
116 | 129 |
117 std::string KeySystemNameForUMAGeneric(const std::string& key_system) { | 130 std::string KeySystemNameForUMAGeneric(const std::string& key_system) { |
118 if (key_system == kClearKeyKeySystem) | 131 if (key_system == kClearKeyKeySystem) |
119 return "ClearKey"; | 132 return "ClearKey"; |
120 #if defined(WIDEVINE_CDM_AVAILABLE) | 133 #if defined(WIDEVINE_CDM_AVAILABLE) |
121 if (key_system == kWidevineKeySystem) | 134 if (key_system == kWidevineKeySystem) |
122 return "Widevine"; | 135 return "Widevine"; |
123 #endif // WIDEVINE_CDM_AVAILABLE | 136 #endif // WIDEVINE_CDM_AVAILABLE |
124 return "Unknown"; | 137 return "Unknown"; |
125 } | 138 } |
126 | 139 |
127 bool CanUseBuiltInAesDecryptor(const std::string& key_system) { | 140 bool CanUseBuiltInAesDecryptor(const std::string& key_system) { |
128 return key_system == kClearKeyKeySystem; | 141 return key_system == kClearKeyKeySystem; |
129 } | 142 } |
130 | 143 |
131 } // namespace webkit_media | 144 } // namespace webkit_media |
OLD | NEW |