| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/blink/key_system_config_selector.h" | 5 #include "media/blink/key_system_config_selector.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 // let session types be candidate configuration's sessionTypes member. | 579 // let session types be candidate configuration's sessionTypes member. |
| 580 // - Otherwise, let session types be [ "temporary" ]. | 580 // - Otherwise, let session types be [ "temporary" ]. |
| 581 // (Done in MediaKeySystemAccessInitializer.) | 581 // (Done in MediaKeySystemAccessInitializer.) |
| 582 blink::WebVector<blink::WebEncryptedMediaSessionType> session_types = | 582 blink::WebVector<blink::WebEncryptedMediaSessionType> session_types = |
| 583 candidate.sessionTypes; | 583 candidate.sessionTypes; |
| 584 | 584 |
| 585 // 13. For each value in session types: | 585 // 13. For each value in session types: |
| 586 for (size_t i = 0; i < session_types.size(); i++) { | 586 for (size_t i = 0; i < session_types.size(); i++) { |
| 587 // 13.1. Let session type be the value. | 587 // 13.1. Let session type be the value. |
| 588 blink::WebEncryptedMediaSessionType session_type = session_types[i]; | 588 blink::WebEncryptedMediaSessionType session_type = session_types[i]; |
| 589 if (session_type == blink::WebEncryptedMediaSessionType::Unknown) { |
| 590 DVLOG(2) << "Rejecting requested configuration because " |
| 591 << "session type was not recognized."; |
| 592 return CONFIGURATION_NOT_SUPPORTED; |
| 593 } |
| 589 | 594 |
| 590 // 13.2. If accumulated configuration's persistentState value is | 595 // 13.2. If accumulated configuration's persistentState value is |
| 591 // "not-allowed" and the Is persistent session type? algorithm | 596 // "not-allowed" and the Is persistent session type? algorithm |
| 592 // returns true for session type return NotSupported. | 597 // returns true for session type return NotSupported. |
| 593 if (accumulated_configuration->persistentState == | 598 if (accumulated_configuration->persistentState == |
| 594 EmeFeatureRequirement::NotAllowed && | 599 EmeFeatureRequirement::NotAllowed && |
| 595 IsPersistentSessionType(session_type)) { | 600 IsPersistentSessionType(session_type)) { |
| 596 DVLOG(2) << "Rejecting requested configuration because persistent " | 601 DVLOG(2) << "Rejecting requested configuration because persistent " |
| 597 "sessions are not allowed."; | 602 "sessions are not allowed."; |
| 598 return CONFIGURATION_NOT_SUPPORTED; | 603 return CONFIGURATION_NOT_SUPPORTED; |
| 599 } | 604 } |
| 600 | 605 |
| 601 // 13.3. If the implementation does not support session type in combination | 606 // 13.3. If the implementation does not support session type in combination |
| 602 // with accumulated configuration and restrictions for other reasons, | 607 // with accumulated configuration and restrictions for other reasons, |
| 603 // return NotSupported. | 608 // return NotSupported. |
| 604 EmeConfigRule session_type_rule = EmeConfigRule::NOT_SUPPORTED; | 609 EmeConfigRule session_type_rule = EmeConfigRule::NOT_SUPPORTED; |
| 605 switch (session_type) { | 610 switch (session_type) { |
| 606 case blink::WebEncryptedMediaSessionType::Unknown: | 611 case blink::WebEncryptedMediaSessionType::Unknown: |
| 607 DVLOG(2) << "Rejecting requested configuration because " | 612 NOTREACHED(); |
| 608 << "a required session type was not recognized."; | |
| 609 return CONFIGURATION_NOT_SUPPORTED; | 613 return CONFIGURATION_NOT_SUPPORTED; |
| 610 case blink::WebEncryptedMediaSessionType::Temporary: | 614 case blink::WebEncryptedMediaSessionType::Temporary: |
| 611 session_type_rule = EmeConfigRule::SUPPORTED; | 615 session_type_rule = EmeConfigRule::SUPPORTED; |
| 612 break; | 616 break; |
| 613 case blink::WebEncryptedMediaSessionType::PersistentLicense: | 617 case blink::WebEncryptedMediaSessionType::PersistentLicense: |
| 614 session_type_rule = GetSessionTypeConfigRule( | 618 session_type_rule = GetSessionTypeConfigRule( |
| 615 key_systems_->GetPersistentLicenseSessionSupport(key_system)); | 619 key_systems_->GetPersistentLicenseSessionSupport(key_system)); |
| 616 break; | 620 break; |
| 617 case blink::WebEncryptedMediaSessionType::PersistentReleaseMessage: | 621 case blink::WebEncryptedMediaSessionType::PersistentReleaseMessage: |
| 618 session_type_rule = GetSessionTypeConfigRule( | 622 session_type_rule = GetSessionTypeConfigRule( |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 | 928 |
| 925 void KeySystemConfigSelector::OnPermissionResult( | 929 void KeySystemConfigSelector::OnPermissionResult( |
| 926 std::unique_ptr<SelectionRequest> request, | 930 std::unique_ptr<SelectionRequest> request, |
| 927 bool is_permission_granted) { | 931 bool is_permission_granted) { |
| 928 request->was_permission_requested = true; | 932 request->was_permission_requested = true; |
| 929 request->is_permission_granted = is_permission_granted; | 933 request->is_permission_granted = is_permission_granted; |
| 930 SelectConfigInternal(std::move(request)); | 934 SelectConfigInternal(std::move(request)); |
| 931 } | 935 } |
| 932 | 936 |
| 933 } // namespace media | 937 } // namespace media |
| OLD | NEW |