| Index: media/base/key_systems.cc
|
| diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc
|
| index f71dae2f18c93cac2395f7b9590693bf63eb4ff4..2bd244a1e38c2da85b2990324da9e65a71a7788d 100644
|
| --- a/media/base/key_systems.cc
|
| +++ b/media/base/key_systems.cc
|
| @@ -19,6 +19,7 @@
|
| #include "media/base/key_system_names.h"
|
| #include "media/base/key_system_properties.h"
|
| #include "media/base/media.h"
|
| +#include "media/base/media_switches.h"
|
| #include "ppapi/features/features.h"
|
| #include "media/base/media_client.h"
|
| #include "third_party/widevine/cdm/widevine_cdm_common.h"
|
| @@ -351,6 +352,33 @@ void KeySystemsImpl::UpdateSupportedKeySystems() {
|
| AddSupportedKeySystems(&key_systems_properties);
|
| }
|
|
|
| +// Returns whether distinctive identifiers and persistent state can be reliably
|
| +// blocked for |properties| (and therefore be safely configurable).
|
| +static bool CanBlock(const KeySystemProperties& properties) {
|
| +#if BUILDFLAG(ENABLE_PEPPER_CDMS)
|
| + // Distinctive identifiers and persistent state can be reliably blocked for
|
| + // Pepper-hosted key systems.
|
| + DCHECK_EQ(properties.UseAesDecryptor(), properties.GetPepperType().empty());
|
| + if (!properties.GetPepperType().empty())
|
| + return true;
|
| +#endif
|
| +
|
| + // When AesDecryptor is used, we are sure we can block.
|
| + if (properties.UseAesDecryptor())
|
| + return true;
|
| +
|
| + // For External Clear Key, it is either implemented as a pepper CDM (Clear Key
|
| + // CDM), which is covered above, or by using AesDecryptor remotely, e.g. via
|
| + // MojoCdm. In both cases, we can block. This is only used for testing.
|
| + if (base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting) &&
|
| + IsExternalClearKey(properties.GetKeySystemName()))
|
| + return true;
|
| +
|
| + // For other platforms assume the CDM can and will do anything. So we cannot
|
| + // block.
|
| + return false;
|
| +}
|
| +
|
| void KeySystemsImpl::AddSupportedKeySystems(
|
| std::vector<std::unique_ptr<KeySystemProperties>>* key_systems) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| @@ -399,23 +427,7 @@ void KeySystemsImpl::AddSupportedKeySystems(
|
| EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER);
|
| }
|
|
|
| - // Distinctive identifiers and persistent state can only be reliably blocked
|
| - // (and therefore be safely configurable) for Pepper-hosted key systems. For
|
| - // other platforms assume the CDM can and will do anything, except for the
|
| - // following two cases:
|
| - // 1) AES decryptor, and
|
| - // 2) External Clear Key key system on Android, only enabled for testing.
|
| - bool can_block = properties->UseAesDecryptor();
|
| -#if BUILDFLAG(ENABLE_PEPPER_CDMS)
|
| - DCHECK_EQ(properties->UseAesDecryptor(),
|
| - properties->GetPepperType().empty());
|
| - if (!properties->GetPepperType().empty())
|
| - can_block = true;
|
| -#elif defined(OS_ANDROID)
|
| - if (IsExternalClearKey(properties->GetKeySystemName()))
|
| - can_block = true;
|
| -#endif
|
| - if (!can_block) {
|
| + if (!CanBlock(*properties)) {
|
| DCHECK(properties->GetDistinctiveIdentifierSupport() ==
|
| EmeFeatureSupport::ALWAYS_ENABLED);
|
| DCHECK(properties->GetPersistentStateSupport() ==
|
|
|