Chromium Code Reviews| Index: media/blink/key_system_config_selector.cc |
| diff --git a/media/blink/key_system_config_selector.cc b/media/blink/key_system_config_selector.cc |
| index ec36f2e7c1b671da1465899ee15d10094064c402..2b56f2661ee9dc26ca83e46de85e9177ea2f58ed 100644 |
| --- a/media/blink/key_system_config_selector.cc |
| +++ b/media/blink/key_system_config_selector.cc |
| @@ -129,6 +129,23 @@ static EmeConfigRule GetPersistentStateConfigRule( |
| return EmeConfigRule::PERSISTENCE_REQUIRED; |
| } |
| +static bool IsPersistentSessionType( |
| + blink::WebEncryptedMediaSessionType sessionType) { |
| + switch (sessionType) { |
| + case blink::WebEncryptedMediaSessionType::Temporary: |
| + return false; |
| + case blink::WebEncryptedMediaSessionType::PersistentLicense: |
| + return true; |
| + case blink::WebEncryptedMediaSessionType::PersistentReleaseMessage: |
| + return true; |
| + case blink::WebEncryptedMediaSessionType::Unknown: |
| + break; |
| + } |
| + |
| + NOTREACHED(); |
| + return false; |
| +} |
| + |
| } // namespace |
| struct KeySystemConfigSelector::SelectionRequest { |
| @@ -434,20 +451,27 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
| const blink::WebMediaKeySystemConfiguration& candidate, |
| ConfigState* config_state, |
| blink::WebMediaKeySystemConfiguration* accumulated_configuration) { |
| - // From https://w3c.github.io/encrypted-media/#get-supported-configuration |
| - // 1. Let accumulated configuration be empty. (Done by caller.) |
| - // 2. If the initDataTypes member is present in candidate configuration, run |
| - // the following steps: |
| - if (candidate.hasInitDataTypes) { |
| - // 2.1. Let supported types be empty. |
| + // From |
| + // http://w3c.github.io/encrypted-media/#get-supported-configuration-and-consent |
| + // 1. Let accumulated configuration be a new MediaKeySystemConfiguration |
| + // dictionary. (Done by caller.) |
| + // 2. Set the label member of accumulated configuration to equal the label |
| + // member of candidate configuration. |
| + accumulated_configuration->label = candidate.label; |
| + |
| + // 3. If the initDataTypes member of candidate configuration is non-empty, |
| + // run the following steps: |
| + if (!candidate.initDataTypes.isEmpty()) { |
| + // 3.1. Let supported types be an empty sequence of DOMStrings. |
| std::vector<blink::WebEncryptedMediaInitDataType> supported_types; |
| - // 2.2. For each value in candidate configuration's initDataTypes member: |
| + // 3.2. For each value in candidate configuration's initDataTypes member: |
| for (size_t i = 0; i < candidate.initDataTypes.size(); i++) { |
| - // 2.2.1. Let initDataType be the value. |
| + // 3.2.1. Let initDataType be the value. |
| blink::WebEncryptedMediaInitDataType init_data_type = |
| candidate.initDataTypes[i]; |
| - // 2.2.2. If the implementation supports generating requests based on |
| + |
| + // 3.2.2. If the implementation supports generating requests based on |
| // initDataType, add initDataType to supported types. String |
| // comparison is case-sensitive. The empty string is never |
| // supported. |
| @@ -457,31 +481,48 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
| } |
| } |
| - // 2.3. If supported types is empty, return null. |
| + // 3.3. If supported types is empty, return null. |
| if (supported_types.empty()) { |
| DVLOG(2) << "Rejecting requested configuration because " |
| << "no initDataType values were supported."; |
| return CONFIGURATION_NOT_SUPPORTED; |
| } |
| - // 2.4. Add supported types to accumulated configuration. |
| + // 3.4. Set the initDataTypes member of accumulated configuration to |
| + // supported types. |
| accumulated_configuration->initDataTypes = supported_types; |
| } |
| - // 3. Follow the steps for the value of candidate configuration's |
| - // distinctiveIdentifier member from the following list: |
| - // - "required": If the implementation does not support a persistent |
| - // Distinctive Identifier in combination with accumulated |
| - // configuration, return null. |
| - // - "optional": Continue. |
| - // - "not-allowed": If the implementation requires a Distinctive |
| - // Identifier in combination with accumulated configuration, return |
| - // null. |
| + // 4. Let distinctive identifier requirement be the value of candidate |
| + // configuration's distinctiveIdentifier member. |
| + EmeFeatureRequirement distinctiveIdentifier = candidate.distinctiveIdentifier; |
| + |
| + // 5. If distinctive identifier requirement is "optional" and Distinctive |
| + // Identifiers are not allowed according to restrictions, set distinctive |
| + // identifier requirement to "not-allowed". |
| + EmeFeatureSupport distinctiveIdentifierSupport = |
|
sandersd (OOO until July 31)
2016/09/16 23:02:10
Nit: variable name does not match Chromium style.
jrummell
2016/09/17 00:15:05
Done.
|
| + key_systems_->GetDistinctiveIdentifierSupport(key_system); |
| + if (distinctiveIdentifier == EmeFeatureRequirement::Optional) { |
| + if (distinctiveIdentifierSupport == EmeFeatureSupport::INVALID || |
| + distinctiveIdentifierSupport == EmeFeatureSupport::NOT_SUPPORTED) { |
| + distinctiveIdentifier = EmeFeatureRequirement::NotAllowed; |
| + } |
| + } |
| + |
| + // 6. Follow the steps for distinctive identifier requirement from the |
| + // following list: |
| + // - "required": If the implementation does not support use of |
| + // Distinctive Identifier(s) in combination with accumulated |
| + // configuration and restrictions, return NotSupported. |
| + // - "optional": Continue with the following steps. |
| + // - "not-allowed": If the implementation requires use Distinctive |
| + // Identifier(s) or Distinctive Permanent Identifier(s) in |
| + // combination with accumulated configuration and restrictions, |
| + // return NotSupported. |
| // We also reject OPTIONAL when distinctive identifiers are ALWAYS_ENABLED and |
| - // permission has already been denied. This would happen anyway at step 11. |
| + // permission has already been denied. This would happen anyway later. |
| EmeConfigRule di_rule = GetDistinctiveIdentifierConfigRule( |
| - key_systems_->GetDistinctiveIdentifierSupport(key_system), |
| - candidate.distinctiveIdentifier); |
| + distinctiveIdentifierSupport, distinctiveIdentifier); |
| if (!config_state->IsRuleSupported(di_rule)) { |
| DVLOG(2) << "Rejecting requested configuration because " |
| << "the distinctiveIdentifier requirement was not supported."; |
| @@ -489,21 +530,37 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
| } |
| config_state->AddRule(di_rule); |
| - // 4. Add the value of the candidate configuration's distinctiveIdentifier |
| - // member to accumulated configuration. |
| - accumulated_configuration->distinctiveIdentifier = |
| - candidate.distinctiveIdentifier; |
| - |
| - // 5. Follow the steps for the value of candidate configuration's |
| - // persistentState member from the following list: |
| - // - "required": If the implementation does not support persisting state |
| - // in combination with accumulated configuration, return null. |
| - // - "optional": Continue. |
| - // - "not-allowed": If the implementation requires persisting state in |
| - // combination with accumulated configuration, return null. |
| - EmeConfigRule ps_rule = GetPersistentStateConfigRule( |
| - key_systems_->GetPersistentStateSupport(key_system), |
| - candidate.persistentState); |
| + // 7. Set the distinctiveIdentifier member of accumulated configuration to |
| + // equal distinctive identifier requirement. |
| + accumulated_configuration->distinctiveIdentifier = distinctiveIdentifier; |
| + |
| + // 8. Let persistent state requirement be equal to the value of candidate |
| + // configuration's persistentState member. |
| + EmeFeatureRequirement persistentState = candidate.persistentState; |
|
sandersd (OOO until July 31)
2016/09/16 23:02:10
Nit: variable name does not match Chromium style.
jrummell
2016/09/17 00:15:05
Done.
|
| + |
| + // 9. If persistent state requirement is "optional" and persisting state is |
| + // not allowed according to restrictions, set persistent state requirement |
| + // to "not-allowed". |
| + EmeFeatureSupport persistentStateSupport = |
|
sandersd (OOO until July 31)
2016/09/16 23:02:10
Nit: variable name does not match Chromium style.
jrummell
2016/09/17 00:15:05
Done.
|
| + key_systems_->GetPersistentStateSupport(key_system); |
| + if (persistentState == EmeFeatureRequirement::Optional) { |
| + if (persistentStateSupport == EmeFeatureSupport::INVALID || |
| + persistentStateSupport == EmeFeatureSupport::NOT_SUPPORTED) { |
| + persistentState = EmeFeatureRequirement::NotAllowed; |
| + } |
| + } |
| + |
| + // 10. Follow the steps for persistent state requirement from the following |
| + // list: |
| + // - "required": If the implementation does not support persisting |
| + // state in combination with accumulated configuration and |
| + // restrictions, return NotSupported. |
| + // - "optional": Continue with the following steps. |
| + // - "not-allowed": If the implementation requires persisting state in |
| + // combination with accumulated configuration and restrictions, |
| + // return NotSupported. |
| + EmeConfigRule ps_rule = |
| + GetPersistentStateConfigRule(persistentStateSupport, persistentState); |
| if (!config_state->IsRuleSupported(ps_rule)) { |
| DVLOG(2) << "Rejecting requested configuration because " |
| << "the persistentState requirement was not supported."; |
| @@ -511,15 +568,15 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
| } |
| config_state->AddRule(ps_rule); |
| - // 6. Add the value of the candidate configuration's persistentState |
| - // member to accumulated configuration. |
| - accumulated_configuration->persistentState = candidate.persistentState; |
| + // 11. Set the persistentState member of accumulated configuration to equal |
| + // the value of persistent state requirement. |
| + accumulated_configuration->persistentState = persistentState; |
| - // 7. Follow the steps for the first matching condition from the following |
| - // list: |
| - // - If the sessionTypes member is present in candidate configuration, |
| - // let session types be candidate configuration's sessionTypes member. |
| - // - Otherwise, let session types be [ "temporary" ]. |
| + // 12. Follow the steps for the first matching condition from the following |
| + // list: |
| + // - If the sessionTypes member is present in candidate configuration, |
| + // let session types be candidate configuration's sessionTypes member. |
| + // - Otherwise, let session types be [ "temporary" ]. |
| blink::WebVector<blink::WebEncryptedMediaSessionType> session_types; |
| if (candidate.hasSessionTypes) { |
| session_types = candidate.sessionTypes; |
| @@ -529,19 +586,25 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
| session_types = temporary; |
| } |
| - // 8. For each value in session types: |
| + // 13. For each value in session types: |
| for (size_t i = 0; i < session_types.size(); i++) { |
| - // 8.1. Let session type be the value. |
| + // 13.1. Let session type be the value. |
| blink::WebEncryptedMediaSessionType session_type = session_types[i]; |
| - // 8.2. If the implementation does not support session type in combination |
| - // with accumulated configuration, return null. |
| - // 8.3. If session type is "persistent-license" or |
| - // "persistent-release-message", follow the steps for accumulated |
| - // configuration's persistentState value from the following list: |
| - // - "required": Continue. |
| - // - "optional": Change accumulated configuration's persistentState |
| - // value to "required". |
| - // - "not-allowed": Return null. |
| + |
| + // 13.2. If accumulated configuration's persistentState value is |
| + // "not-allowed" and the Is persistent session type? algorithm |
| + // returns true for session type return NotSupported. |
| + if (accumulated_configuration->persistentState == |
| + EmeFeatureRequirement::NotAllowed && |
| + IsPersistentSessionType(session_type)) { |
| + DVLOG(2) << "Rejecting requested configuration because persistent " |
| + "sessions are not allowed."; |
| + return CONFIGURATION_NOT_SUPPORTED; |
| + } |
| + |
| + // 13.3. If the implementation does not support session type in combination |
| + // with accumulated configuration and restrictions for other reasons, |
| + // return NotSupported. |
| EmeConfigRule session_type_rule = EmeConfigRule::NOT_SUPPORTED; |
| switch (session_type) { |
| case blink::WebEncryptedMediaSessionType::Unknown: |
| @@ -561,65 +624,94 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
| key_system)); |
| break; |
| } |
| + |
| if (!config_state->IsRuleSupported(session_type_rule)) { |
| DVLOG(2) << "Rejecting requested configuration because " |
| << "a required session type was not supported."; |
| return CONFIGURATION_NOT_SUPPORTED; |
| } |
| config_state->AddRule(session_type_rule); |
| + |
| + // 13.4. If accumulated configuration's persistentState value is "optional" |
| + // and the result of running the Is persistent session type? |
| + // algorithm on session type is true, change accumulated |
| + // configuration's persistentState value to "required". |
| + if (accumulated_configuration->persistentState == |
| + EmeFeatureRequirement::Optional && |
| + IsPersistentSessionType(session_type)) { |
| + accumulated_configuration->persistentState = |
| + EmeFeatureRequirement::Required; |
| + } |
| } |
| - // 9. Add session types to accumulated configuration. |
| + // 14. Set the sessionTypes member of accumulated configuration to |
| + // session types. |
| accumulated_configuration->sessionTypes = session_types; |
| - // 10. If the videoCapabilities member is present in candidate configuration: |
| - if (candidate.hasVideoCapabilities) { |
| - // 10.1. Let video capabilities be the result of executing the Get Supported |
| - // Capabilities for Media Type algorithm on Video, candidate |
| - // configuration's videoCapabilities member, and accumulated |
| - // configuration. |
| - // 10.2. If video capabilities is null, return null. |
| - std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities; |
| + // 15. If the videoCapabilities and audioCapabilities members in candidate |
| + // configuration are both empty, return NotSupported. |
| + // TODO(jrummell): Enforce this once the deprecation warning is removed. |
| + // See http://crbug.com/616233. |
| + |
| + // 16. If the videoCapabilities member in candidate configuration is |
| + // non-empty: |
| + std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities; |
| + if (!candidate.videoCapabilities.isEmpty()) { |
| + // 16.1. Let video capabilities be the result of executing the Get |
| + // Supported Capabilities for Audio/Video Type algorithm on Video, |
| + // candidate configuration's videoCapabilities member, accumulated |
| + // configuration, and restrictions. |
| + // 16.2. If video capabilities is null, return NotSupported. |
| if (!GetSupportedCapabilities(key_system, EmeMediaType::VIDEO, |
| candidate.videoCapabilities, config_state, |
| &video_capabilities)) { |
| return CONFIGURATION_NOT_SUPPORTED; |
| } |
| - // 10.3. Add video capabilities to accumulated configuration. |
| - accumulated_configuration->hasVideoCapabilities = true; |
| + // 16.3. Set the videoCapabilities member of accumulated configuration |
| + // to video capabilities. |
| + accumulated_configuration->videoCapabilities = video_capabilities; |
| + } else { |
| + // Otherwise set the videoCapabilities member of accumulated configuration |
| + // to an empty sequence. |
| accumulated_configuration->videoCapabilities = video_capabilities; |
| } |
| - // 11. If the audioCapabilities member is present in candidate configuration: |
| - if (candidate.hasAudioCapabilities) { |
| - // 11.1. Let audio capabilities be the result of executing the Get Supported |
| - // Capabilities for Media Type algorithm on Audio, candidate |
| - // configuration's audioCapabilities member, and accumulated |
| - // configuration. |
| - // 11.2. If audio capabilities is null, return null. |
| - std::vector<blink::WebMediaKeySystemMediaCapability> audio_capabilities; |
| + // 17. If the audioCapabilities member in candidate configuration is |
| + // non-empty: |
| + std::vector<blink::WebMediaKeySystemMediaCapability> audio_capabilities; |
| + if (!candidate.audioCapabilities.isEmpty()) { |
| + // 17.1. Let audio capabilities be the result of executing the Get |
| + // Supported Capabilities for Audio/Video Type algorithm on Audio, |
| + // candidate configuration's audioCapabilities member, accumulated |
| + // configuration, and restrictions. |
| + // 17.2. If audio capabilities is null, return NotSupported. |
| if (!GetSupportedCapabilities(key_system, EmeMediaType::AUDIO, |
| candidate.audioCapabilities, config_state, |
| &audio_capabilities)) { |
| return CONFIGURATION_NOT_SUPPORTED; |
| } |
| - // 11.3. Add audio capabilities to accumulated configuration. |
| - accumulated_configuration->hasAudioCapabilities = true; |
| + // 17.3. Set the audioCapabilities member of accumulated configuration |
| + // to audio capabilities. |
| + accumulated_configuration->audioCapabilities = audio_capabilities; |
| + } else { |
| + // Otherwise set the audioCapabilities member of accumulated configuration |
| + // to an empty sequence. |
| accumulated_configuration->audioCapabilities = audio_capabilities; |
| } |
| - // 12. If accumulated configuration's distinctiveIdentifier value is |
| - // "optional", follow the steps for the first matching condition from the |
| - // following list: |
| - // - If the implementation requires a Distinctive Identifier for any of |
| - // the combinations in accumulated configuration, change accumulated |
| - // configuration's distinctiveIdentifier value to "required". |
| - // - Otherwise, change accumulated configuration's distinctiveIdentifier |
| - // value to "not-allowed". |
| + // 18. If accumulated configuration's distinctiveIdentifier value is |
| + // "optional", follow the steps for the first matching condition |
| + // from the following list: |
| + // - If the implementation requires use Distinctive Identifier(s) or |
| + // Distinctive Permanent Identifier(s) for any of the combinations |
| + // in accumulated configuration, change accumulated configuration's |
| + // distinctiveIdentifier value to "required". |
| + // - Otherwise, change accumulated configuration's |
| + // distinctiveIdentifier value to "not-allowed". |
| if (accumulated_configuration->distinctiveIdentifier == |
| - blink::WebMediaKeySystemConfiguration::Requirement::Optional) { |
| + EmeFeatureRequirement::Optional) { |
| EmeConfigRule not_allowed_rule = GetDistinctiveIdentifierConfigRule( |
| key_systems_->GetDistinctiveIdentifierSupport(key_system), |
| EmeFeatureRequirement::NotAllowed); |
| @@ -637,29 +729,29 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
| } |
| if (not_allowed_supported) { |
| accumulated_configuration->distinctiveIdentifier = |
| - blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed; |
| + EmeFeatureRequirement::NotAllowed; |
| config_state->AddRule(not_allowed_rule); |
| } else if (required_supported) { |
| accumulated_configuration->distinctiveIdentifier = |
| - blink::WebMediaKeySystemConfiguration::Requirement::Required; |
| + EmeFeatureRequirement::Required; |
| config_state->AddRule(required_rule); |
| } else { |
| - // We should not have passed step 3. |
| + // We should not have passed step 6. |
| NOTREACHED(); |
| return CONFIGURATION_NOT_SUPPORTED; |
| } |
| } |
| - // 13. If accumulated configuration's persistentState value is "optional", |
| + // 19. If accumulated configuration's persistentState value is "optional", |
| // follow the steps for the first matching condition from the following |
| // list: |
| // - If the implementation requires persisting state for any of the |
| // combinations in accumulated configuration, change accumulated |
| // configuration's persistentState value to "required". |
| - // - Otherwise, change accumulated configuration's persistentState value |
| - // to "not-allowed". |
| + // - Otherwise, change accumulated configuration's persistentState |
| + // value to "not-allowed". |
| if (accumulated_configuration->persistentState == |
| - blink::WebMediaKeySystemConfiguration::Requirement::Optional) { |
| + EmeFeatureRequirement::Optional) { |
| EmeConfigRule not_allowed_rule = GetPersistentStateConfigRule( |
| key_systems_->GetPersistentStateSupport(key_system), |
| EmeFeatureRequirement::NotAllowed); |
| @@ -676,11 +768,11 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
| bool required_supported = config_state->IsRuleSupported(required_rule); |
| if (not_allowed_supported) { |
| accumulated_configuration->persistentState = |
| - blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed; |
| + EmeFeatureRequirement::NotAllowed; |
| config_state->AddRule(not_allowed_rule); |
| } else if (required_supported) { |
| accumulated_configuration->persistentState = |
| - blink::WebMediaKeySystemConfiguration::Requirement::Required; |
| + EmeFeatureRequirement::Required; |
| config_state->AddRule(required_rule); |
| } else { |
| // We should not have passed step 5. |
| @@ -689,25 +781,44 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
| } |
| } |
| - // 14. If implementation in the configuration specified by the combination of |
| + // 20. If implementation in the configuration specified by the combination of |
| // the values in accumulated configuration is not supported or not allowed |
| - // in the origin, return null. |
| - // 15. If accumulated configuration's distinctiveIdentifier value is |
| - // "required", [prompt the user for consent]. |
| + // in the origin, return NotSupported. |
| + // TODO(jrummell): can we check that the CDM can't be loaded by the origin? |
| + |
| + // 21. If accumulated configuration's distinctiveIdentifier value is |
| + // "required" and the Distinctive Identifier(s) associated with |
| + // accumulated configuration are not unique per origin and profile |
| + // and clearable: |
| + // 21.1. Update restrictions to reflect that all configurations described |
| + // by accumulated configuration do not have user consent. |
| + // 21.2. Return ConsentDenied and restrictions. |
| + // (Not required as data is unique per origin and clearable.) |
| + |
| + // 22. Let consent status and updated restrictions be the result of running |
| + // the Get Consent Status algorithm on accumulated configuration, |
| + // restrictions and origin and follow the steps for the value of consent |
| + // status from the following list: |
| + // - "ConsentDenied": Return ConsentDenied and updated restrictions. |
| + // - "InformUser": Inform the user that accumulated configuration is |
| + // in use in the origin including, specifically, the information |
| + // that Distinctive Identifier(s) and/or Distinctive Permanent |
| + // Identifier(s) as appropriate will be used if the |
| + // distinctiveIdentifier member of accumulated configuration is |
| + // "required". Continue to the next step. |
| + // - "Allowed": Continue to the next step. |
| + // Accumulated configuration's distinctiveIdentifier should be "required" or |
| + // "notallowed"" due to step 18. If it is "required", prompt the user for |
| + // consent unless it has already been granted. |
| if (accumulated_configuration->distinctiveIdentifier == |
| - blink::WebMediaKeySystemConfiguration::Requirement::Required) { |
| + EmeFeatureRequirement::Required) { |
| // The caller is responsible for resolving what to do if permission is |
| // required but has been denied (it should treat it as NOT_SUPPORTED). |
| if (!config_state->IsPermissionGranted()) |
| return CONFIGURATION_REQUIRES_PERMISSION; |
| } |
| - // 16. If the label member is present in candidate configuration, add the |
| - // value of the candidate configuration's label member to accumulated |
| - // configuration. |
| - accumulated_configuration->label = candidate.label; |
| - |
| - // 17. Return accumulated configuration. |
| + // 23. Return accumulated configuration. |
| return CONFIGURATION_SUPPORTED; |
| } |
| @@ -720,12 +831,12 @@ void KeySystemConfigSelector::SelectConfig( |
| base::Callback<void(const blink::WebMediaKeySystemConfiguration&, |
| const CdmConfig&)> succeeded_cb, |
| base::Callback<void(const blink::WebString&)> not_supported_cb) { |
| - // Continued from requestMediaKeySystemAccess(), step 7, from |
| + // Continued from requestMediaKeySystemAccess(), step 6, from |
| // https://w3c.github.io/encrypted-media/#requestmediakeysystemaccess |
| // |
| - // 7.1. If keySystem is not one of the Key Systems supported by the user |
| - // agent, reject promise with with a new DOMException whose name is |
| - // NotSupportedError. String comparison is case-sensitive. |
| + // 6.1 If keySystem is not one of the Key Systems supported by the user |
| + // agent, reject promise with a NotSupportedError. String comparison |
| + // is case-sensitive. |
| if (!base::IsStringASCII(key_system)) { |
| not_supported_cb.Run("Only ASCII keySystems are supported"); |
| return; |
| @@ -738,7 +849,7 @@ void KeySystemConfigSelector::SelectConfig( |
| return; |
| } |
| - // 7.2-7.4. Implemented by OnSelectConfig(). |
| + // 6.2-6.4. Implemented by OnSelectConfig(). |
| // TODO(sandersd): This should be async, ideally not on the main thread. |
| std::unique_ptr<SelectionRequest> request(new SelectionRequest()); |
| request->key_system = key_system_ascii; |
| @@ -752,19 +863,19 @@ void KeySystemConfigSelector::SelectConfig( |
| void KeySystemConfigSelector::SelectConfigInternal( |
| std::unique_ptr<SelectionRequest> request) { |
| - // Continued from requestMediaKeySystemAccess(), step 7.1, from |
| + // Continued from requestMediaKeySystemAccess(), step 6, from |
| // https://w3c.github.io/encrypted-media/#requestmediakeysystemaccess |
| // |
| - // 7.2. Let implementation be the implementation of keySystem. |
| + // 6.2. Let implementation be the implementation of keySystem. |
| // (|key_systems_| fills this role.) |
| - // 7.3. For each value in supportedConfigurations: |
| + // 6.3. For each value in supportedConfigurations: |
| for (size_t i = 0; i < request->candidate_configurations.size(); i++) { |
| - // 7.3.1. Let candidate configuration be the value. |
| - // 7.3.2. Let supported configuration be the result of executing the Get |
| + // 6.3.1. Let candidate configuration be the value. |
| + // 6.3.2. Let supported configuration be the result of executing the Get |
| // Supported Configuration algorithm on implementation, candidate |
| // configuration, and origin. |
| - // 7.3.3. If supported configuration is not null, [initialize and return a |
| - // new MediaKeySystemAccess object.] |
| + // 6.3.3. If supported configuration is not NotSupported, [initialize |
| + // and return a new MediaKeySystemAccess object.] |
| ConfigState config_state(request->was_permission_requested, |
| request->is_permission_granted); |
| DCHECK(config_state.IsRuleSupported( |
| @@ -799,10 +910,10 @@ void KeySystemConfigSelector::SelectConfigInternal( |
| case CONFIGURATION_SUPPORTED: |
| cdm_config.allow_distinctive_identifier = |
| (accumulated_configuration.distinctiveIdentifier == |
| - blink::WebMediaKeySystemConfiguration::Requirement::Required); |
| + EmeFeatureRequirement::Required); |
| cdm_config.allow_persistent_state = |
| (accumulated_configuration.persistentState == |
| - blink::WebMediaKeySystemConfiguration::Requirement::Required); |
| + EmeFeatureRequirement::Required); |
| cdm_config.use_hw_secure_codecs = |
| config_state.AreHwSecureCodecsRequired(); |
| request->succeeded_cb.Run(accumulated_configuration, cdm_config); |
| @@ -810,8 +921,7 @@ void KeySystemConfigSelector::SelectConfigInternal( |
| } |
| } |
| - // 7.4. Reject promise with a new DOMException whose name is |
| - // NotSupportedError. |
| + // 6.4. Reject promise with a NotSupportedError. |
| request->not_supported_cb.Run( |
| "None of the requested configurations were supported."); |
| } |