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

Side by Side Diff: media/base/key_systems.cc

Issue 945063002: Restore L3 support on CrOS when the media permission is denied. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 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 "media/base/key_systems.h" 5 #include "media/base/key_systems.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 const std::vector<KeySystemInfo>& concrete_key_systems) { 388 const std::vector<KeySystemInfo>& concrete_key_systems) {
389 DCHECK(thread_checker_.CalledOnValidThread()); 389 DCHECK(thread_checker_.CalledOnValidThread());
390 DCHECK(concrete_key_system_map_.empty()); 390 DCHECK(concrete_key_system_map_.empty());
391 DCHECK(parent_key_system_map_.empty()); 391 DCHECK(parent_key_system_map_.empty());
392 392
393 for (const KeySystemInfo& info : concrete_key_systems) { 393 for (const KeySystemInfo& info : concrete_key_systems) {
394 DCHECK(!info.key_system.empty()); 394 DCHECK(!info.key_system.empty());
395 DCHECK_NE(info.persistent_license_support, EME_SESSION_TYPE_INVALID); 395 DCHECK_NE(info.persistent_license_support, EME_SESSION_TYPE_INVALID);
396 DCHECK_NE(info.persistent_release_message_support, 396 DCHECK_NE(info.persistent_release_message_support,
397 EME_SESSION_TYPE_INVALID); 397 EME_SESSION_TYPE_INVALID);
398 // REQUESTABLE and REQUESTABLE_WITH_PERMISSION are not available until we 398 // TODO(sandersd): Add REQUESTABLE and REQUESTABLE_WITH_PERMISSION for
399 // can block access/ per-CDM-instance. http://crbug.com/457482 399 // persistent_state_support once we can block access per-CDM-instance
400 // Note: Even once that is fixed, distinctive identifiers should never be 400 // (http://crbug.com/457482).
401 // REQUESTABLE, since user permission is always required.
402 DCHECK(info.persistent_state_support == EME_FEATURE_NOT_SUPPORTED || 401 DCHECK(info.persistent_state_support == EME_FEATURE_NOT_SUPPORTED ||
403 info.persistent_state_support == EME_FEATURE_ALWAYS_ENABLED); 402 info.persistent_state_support == EME_FEATURE_ALWAYS_ENABLED);
404 DCHECK(info.distinctive_identifier_support == EME_FEATURE_NOT_SUPPORTED || 403 DCHECK(info.distinctive_identifier_support == EME_FEATURE_NOT_SUPPORTED ||
404 // TODO(sandersd): REQUESTABLE_WITH_PERMISSION for all key systems on all
405 // platforms once we have proper enforcement (http://crbug.com/457482).
406 // On Chrome OS, an ID will not be used without permission, but we cannot
407 // currently prevent the CDM from requesting the permission again when no
408 // there was no initial prompt. Thus, we block "not-allowed" below.
409 #if defined(OS_CHROMEOS)
410 (info.distinctive_identifier_support ==
411 EME_FEATURE_REQUESTABLE_WITH_PERMISSION &&
412 key_system == kWidevineKeySystem) ||
413 #endif
405 info.distinctive_identifier_support == EME_FEATURE_ALWAYS_ENABLED); 414 info.distinctive_identifier_support == EME_FEATURE_ALWAYS_ENABLED);
406 if (info.persistent_state_support == EME_FEATURE_NOT_SUPPORTED) { 415 if (info.persistent_state_support == EME_FEATURE_NOT_SUPPORTED) {
407 DCHECK_EQ(info.persistent_license_support, 416 DCHECK_EQ(info.persistent_license_support,
408 EME_SESSION_TYPE_NOT_SUPPORTED); 417 EME_SESSION_TYPE_NOT_SUPPORTED);
409 DCHECK_EQ(info.persistent_release_message_support, 418 DCHECK_EQ(info.persistent_release_message_support,
410 EME_SESSION_TYPE_NOT_SUPPORTED); 419 EME_SESSION_TYPE_NOT_SUPPORTED);
411 } 420 }
412 DCHECK(!IsSupportedKeySystem(info.key_system)) 421 DCHECK(!IsSupportedKeySystem(info.key_system))
413 << "Key system '" << info.key_system << "' already registered"; 422 << "Key system '" << info.key_system << "' already registered";
414 DCHECK(!parent_key_system_map_.count(info.key_system)) 423 DCHECK(!parent_key_system_map_.count(info.key_system))
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 return false; 717 return false;
709 } 718 }
710 719
711 switch (key_system_iter->second.distinctive_identifier_support) { 720 switch (key_system_iter->second.distinctive_identifier_support) {
712 case EME_FEATURE_INVALID: 721 case EME_FEATURE_INVALID:
713 NOTREACHED(); 722 NOTREACHED();
714 return false; 723 return false;
715 case EME_FEATURE_NOT_SUPPORTED: 724 case EME_FEATURE_NOT_SUPPORTED:
716 return requirement != EME_FEATURE_REQUIRED; 725 return requirement != EME_FEATURE_REQUIRED;
717 case EME_FEATURE_REQUESTABLE_WITH_PERMISSION: 726 case EME_FEATURE_REQUESTABLE_WITH_PERMISSION:
727 // TODO(sandersd): Remove this hack once crbug.com/457482 is addressed.
728 // We cannot currently enforce "not-allowed", so don't allow it.
729 if (requirement == EME_FEATURE_NOT_ALLOWED)
730 return false;
718 return (requirement != EME_FEATURE_REQUIRED) || is_permission_granted; 731 return (requirement != EME_FEATURE_REQUIRED) || is_permission_granted;
719 case EME_FEATURE_REQUESTABLE: 732 case EME_FEATURE_REQUESTABLE:
720 NOTREACHED(); 733 NOTREACHED();
721 return true; 734 return true;
722 case EME_FEATURE_ALWAYS_ENABLED: 735 case EME_FEATURE_ALWAYS_ENABLED:
723 // Distinctive identifiers always require user permission. 736 // Distinctive identifiers always require user permission.
724 return (requirement != EME_FEATURE_NOT_ALLOWED) && is_permission_granted; 737 return (requirement != EME_FEATURE_NOT_ALLOWED) && is_permission_granted;
725 } 738 }
726 739
727 NOTREACHED(); 740 NOTREACHED();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 881
869 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask) { 882 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask) {
870 KeySystems::GetInstance().AddContainerMask(container, mask); 883 KeySystems::GetInstance().AddContainerMask(container, mask);
871 } 884 }
872 885
873 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { 886 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) {
874 KeySystems::GetInstance().AddCodecMask(codec, mask); 887 KeySystems::GetInstance().AddCodecMask(codec, mask);
875 } 888 }
876 889
877 } // namespace media 890 } // namespace media
OLDNEW
« chrome/renderer/media/chrome_key_systems.cc ('K') | « chrome/renderer/media/chrome_key_systems.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698