Enable right clicking on the applist doodle web contents and log the data.
[chromium-blink-merge.git] / media / base / key_systems.h
blob93317a118fcd117032cd452da44a54fb40e745ba
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_KEY_SYSTEMS_H_
6 #define MEDIA_BASE_KEY_SYSTEMS_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/scoped_ptr.h"
12 #include "media/base/eme_constants.h"
13 #include "media/base/media_export.h"
15 namespace media {
17 // Prefixed EME API only supports prefixed (webkit-) key system name for
18 // certain key systems. But internally only unprefixed key systems are
19 // supported. The following two functions help convert between prefixed and
20 // unprefixed key system names.
22 // Gets the unprefixed key system name for |key_system|.
23 MEDIA_EXPORT std::string GetUnprefixedKeySystemName(
24 const std::string& key_system);
26 // Gets the prefixed key system name for |key_system|.
27 MEDIA_EXPORT std::string GetPrefixedKeySystemName(
28 const std::string& key_system);
30 // Returns false if a container-specific |init_data_type| is specified with an
31 // inappropriate container.
32 // TODO(sandersd): Remove this essentially internal detail if the spec is
33 // updated to not convolve the two in a single method call.
34 // TODO(sandersd): Use enum values instead of strings. http://crbug.com/417440
35 MEDIA_EXPORT bool IsSaneInitDataTypeWithContainer(
36 const std::string& init_data_type,
37 const std::string& container);
39 // Use for unprefixed EME only!
40 // Returns whether |key_system| is a supported key system.
41 // Note: Shouldn't be used for prefixed API as the original
42 // IsSupportedKeySystemWithMediaMimeType() path reports UMAs, but this path does
43 // not.
44 MEDIA_EXPORT bool IsSupportedKeySystem(const std::string& key_system);
46 MEDIA_EXPORT bool IsSupportedKeySystemWithInitDataType(
47 const std::string& key_system,
48 const std::string& init_data_type);
50 // Use for prefixed EME only!
51 // Returns whether |key_system| is a real supported key system that can be
52 // instantiated.
53 // Abstract parent |key_system| strings will return false.
54 // Call IsSupportedKeySystemWithMediaMimeType() to determine whether a
55 // |key_system| supports a specific type of media or to check parent key
56 // systems.
57 MEDIA_EXPORT bool PrefixedIsSupportedConcreteKeySystem(
58 const std::string& key_system);
60 // Use for unprefixed EME only!
61 // Returns whether |key_system| supports the specified media type and codec(s).
62 MEDIA_EXPORT bool IsSupportedKeySystemWithMediaMimeType(
63 const std::string& mime_type,
64 const std::vector<std::string>& codecs,
65 const std::string& key_system);
67 // Use for prefixed EME only!
68 // Returns whether |key_system| supports the specified media type and codec(s).
69 // To be used with prefixed EME only as it generates UMAs based on the query.
70 MEDIA_EXPORT bool PrefixedIsSupportedKeySystemWithMediaMimeType(
71 const std::string& mime_type,
72 const std::vector<std::string>& codecs,
73 const std::string& key_system);
75 // Returns a name for |key_system| suitable to UMA logging.
76 MEDIA_EXPORT std::string GetKeySystemNameForUMA(const std::string& key_system);
78 // Returns whether AesDecryptor can be used for the given |concrete_key_system|.
79 MEDIA_EXPORT bool CanUseAesDecryptor(const std::string& concrete_key_system);
81 #if defined(ENABLE_PEPPER_CDMS)
82 // Returns the Pepper MIME type for |concrete_key_system|.
83 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based.
84 MEDIA_EXPORT std::string GetPepperType(
85 const std::string& concrete_key_system);
86 #endif
88 // Returns whether |key_system| supports persistent-license sessions.
89 MEDIA_EXPORT bool IsPersistentLicenseSessionSupported(
90 const std::string& key_system,
91 bool is_permission_granted);
93 // Returns whether |key_system| supports persistent-release-message sessions.
94 MEDIA_EXPORT bool IsPersistentReleaseMessageSessionSupported(
95 const std::string& key_system,
96 bool is_permission_granted);
98 // Returns whether |key_system| supports persistent state as requested.
99 MEDIA_EXPORT bool IsPersistentStateRequirementSupported(
100 const std::string& key_system,
101 EmeFeatureRequirement requirement,
102 bool is_permission_granted);
104 // Returns whether |key_system| supports distinctive identifiers as requested.
105 MEDIA_EXPORT bool IsDistinctiveIdentifierRequirementSupported(
106 const std::string& key_system,
107 EmeFeatureRequirement requirement,
108 bool is_permission_granted);
110 #if defined(UNIT_TEST)
111 // Helper functions to add container/codec types for testing purposes.
112 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask);
113 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask);
114 #endif // defined(UNIT_TEST)
116 } // namespace media
118 #endif // MEDIA_BASE_KEY_SYSTEMS_H_