Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: media/blink/key_system_config_selector.cc

Issue 2799563002: Replace usage of WebVector::isEmpty with WebVector::empty().
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 // From 454 // From
455 // http://w3c.github.io/encrypted-media/#get-supported-configuration-and-conse nt 455 // http://w3c.github.io/encrypted-media/#get-supported-configuration-and-conse nt
456 // 1. Let accumulated configuration be a new MediaKeySystemConfiguration 456 // 1. Let accumulated configuration be a new MediaKeySystemConfiguration
457 // dictionary. (Done by caller.) 457 // dictionary. (Done by caller.)
458 // 2. Set the label member of accumulated configuration to equal the label 458 // 2. Set the label member of accumulated configuration to equal the label
459 // member of candidate configuration. 459 // member of candidate configuration.
460 accumulated_configuration->label = candidate.label; 460 accumulated_configuration->label = candidate.label;
461 461
462 // 3. If the initDataTypes member of candidate configuration is non-empty, 462 // 3. If the initDataTypes member of candidate configuration is non-empty,
463 // run the following steps: 463 // run the following steps:
464 if (!candidate.initDataTypes.isEmpty()) { 464 if (!candidate.initDataTypes.empty()) {
465 // 3.1. Let supported types be an empty sequence of DOMStrings. 465 // 3.1. Let supported types be an empty sequence of DOMStrings.
466 std::vector<blink::WebEncryptedMediaInitDataType> supported_types; 466 std::vector<blink::WebEncryptedMediaInitDataType> supported_types;
467 467
468 // 3.2. For each value in candidate configuration's initDataTypes member: 468 // 3.2. For each value in candidate configuration's initDataTypes member:
469 for (size_t i = 0; i < candidate.initDataTypes.size(); i++) { 469 for (size_t i = 0; i < candidate.initDataTypes.size(); i++) {
470 // 3.2.1. Let initDataType be the value. 470 // 3.2.1. Let initDataType be the value.
471 blink::WebEncryptedMediaInitDataType init_data_type = 471 blink::WebEncryptedMediaInitDataType init_data_type =
472 candidate.initDataTypes[i]; 472 candidate.initDataTypes[i];
473 473
474 // 3.2.2. If the implementation supports generating requests based on 474 // 3.2.2. If the implementation supports generating requests based on
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 EmeFeatureRequirement::Required; 643 EmeFeatureRequirement::Required;
644 } 644 }
645 } 645 }
646 646
647 // 14. Set the sessionTypes member of accumulated configuration to 647 // 14. Set the sessionTypes member of accumulated configuration to
648 // session types. 648 // session types.
649 accumulated_configuration->sessionTypes = session_types; 649 accumulated_configuration->sessionTypes = session_types;
650 650
651 // 15. If the videoCapabilities and audioCapabilities members in candidate 651 // 15. If the videoCapabilities and audioCapabilities members in candidate
652 // configuration are both empty, return NotSupported. 652 // configuration are both empty, return NotSupported.
653 if (candidate.videoCapabilities.isEmpty() && 653 if (candidate.videoCapabilities.empty() &&
654 candidate.audioCapabilities.isEmpty()) { 654 candidate.audioCapabilities.empty()) {
655 DVLOG(2) << "Rejecting requested configuration because " 655 DVLOG(2) << "Rejecting requested configuration because "
656 << "neither audioCapabilities nor videoCapabilities is specified"; 656 << "neither audioCapabilities nor videoCapabilities is specified";
657 return CONFIGURATION_NOT_SUPPORTED; 657 return CONFIGURATION_NOT_SUPPORTED;
658 } 658 }
659 659
660 // 16. If the videoCapabilities member in candidate configuration is 660 // 16. If the videoCapabilities member in candidate configuration is
661 // non-empty: 661 // non-empty:
662 std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities; 662 std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities;
663 if (!candidate.videoCapabilities.isEmpty()) { 663 if (!candidate.videoCapabilities.empty()) {
664 // 16.1. Let video capabilities be the result of executing the Get 664 // 16.1. Let video capabilities be the result of executing the Get
665 // Supported Capabilities for Audio/Video Type algorithm on Video, 665 // Supported Capabilities for Audio/Video Type algorithm on Video,
666 // candidate configuration's videoCapabilities member, accumulated 666 // candidate configuration's videoCapabilities member, accumulated
667 // configuration, and restrictions. 667 // configuration, and restrictions.
668 // 16.2. If video capabilities is null, return NotSupported. 668 // 16.2. If video capabilities is null, return NotSupported.
669 if (!GetSupportedCapabilities(key_system, EmeMediaType::VIDEO, 669 if (!GetSupportedCapabilities(key_system, EmeMediaType::VIDEO,
670 candidate.videoCapabilities, config_state, 670 candidate.videoCapabilities, config_state,
671 &video_capabilities)) { 671 &video_capabilities)) {
672 return CONFIGURATION_NOT_SUPPORTED; 672 return CONFIGURATION_NOT_SUPPORTED;
673 } 673 }
674 674
675 // 16.3. Set the videoCapabilities member of accumulated configuration 675 // 16.3. Set the videoCapabilities member of accumulated configuration
676 // to video capabilities. 676 // to video capabilities.
677 accumulated_configuration->videoCapabilities = video_capabilities; 677 accumulated_configuration->videoCapabilities = video_capabilities;
678 } else { 678 } else {
679 // Otherwise set the videoCapabilities member of accumulated configuration 679 // Otherwise set the videoCapabilities member of accumulated configuration
680 // to an empty sequence. 680 // to an empty sequence.
681 accumulated_configuration->videoCapabilities = video_capabilities; 681 accumulated_configuration->videoCapabilities = video_capabilities;
682 } 682 }
683 683
684 // 17. If the audioCapabilities member in candidate configuration is 684 // 17. If the audioCapabilities member in candidate configuration is
685 // non-empty: 685 // non-empty:
686 std::vector<blink::WebMediaKeySystemMediaCapability> audio_capabilities; 686 std::vector<blink::WebMediaKeySystemMediaCapability> audio_capabilities;
687 if (!candidate.audioCapabilities.isEmpty()) { 687 if (!candidate.audioCapabilities.empty()) {
688 // 17.1. Let audio capabilities be the result of executing the Get 688 // 17.1. Let audio capabilities be the result of executing the Get
689 // Supported Capabilities for Audio/Video Type algorithm on Audio, 689 // Supported Capabilities for Audio/Video Type algorithm on Audio,
690 // candidate configuration's audioCapabilities member, accumulated 690 // candidate configuration's audioCapabilities member, accumulated
691 // configuration, and restrictions. 691 // configuration, and restrictions.
692 // 17.2. If audio capabilities is null, return NotSupported. 692 // 17.2. If audio capabilities is null, return NotSupported.
693 if (!GetSupportedCapabilities(key_system, EmeMediaType::AUDIO, 693 if (!GetSupportedCapabilities(key_system, EmeMediaType::AUDIO,
694 candidate.audioCapabilities, config_state, 694 candidate.audioCapabilities, config_state,
695 &audio_capabilities)) { 695 &audio_capabilities)) {
696 return CONFIGURATION_NOT_SUPPORTED; 696 return CONFIGURATION_NOT_SUPPORTED;
697 } 697 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 930
931 void KeySystemConfigSelector::OnPermissionResult( 931 void KeySystemConfigSelector::OnPermissionResult(
932 std::unique_ptr<SelectionRequest> request, 932 std::unique_ptr<SelectionRequest> request,
933 bool is_permission_granted) { 933 bool is_permission_granted) {
934 request->was_permission_requested = true; 934 request->was_permission_requested = true;
935 request->is_permission_granted = is_permission_granted; 935 request->is_permission_granted = is_permission_granted;
936 SelectConfigInternal(std::move(request)); 936 SelectConfigInternal(std::move(request));
937 } 937 }
938 938
939 } // namespace media 939 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698