OLD | NEW |
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 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ |
6 #define CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ | 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 // * Abstract key system | 25 // * Abstract key system |
26 // A key system string that cannot be instantiated like a concrete key system | 26 // A key system string that cannot be instantiated like a concrete key system |
27 // but is otherwise useful, such as in discovery using isTypeSupported(). | 27 // but is otherwise useful, such as in discovery using isTypeSupported(). |
28 // * Parent key system | 28 // * Parent key system |
29 // A key system string that is one level up from the child key system. It may | 29 // A key system string that is one level up from the child key system. It may |
30 // be an abstract key system. | 30 // be an abstract key system. |
31 // As an example, "com.example" is the parent of "com.example.foo". | 31 // As an example, "com.example" is the parent of "com.example.foo". |
32 | 32 |
33 namespace content { | 33 namespace content { |
34 | 34 |
| 35 // Adds a concrete key system along with platform-specific information about how |
| 36 // to instantiate it. Must be called before AddSupportedType(). |
| 37 // May only be called once per |key_system|. |
| 38 // When not empty, |parent_key_system| will add a mapping to the concrete |
| 39 // |key_system| that can be used to check supported types. |
| 40 CONTENT_EXPORT void AddConcreteSupportedKeySystem( |
| 41 const std::string& key_system, |
| 42 bool use_aes_decryptor, |
| 43 #if defined(ENABLE_PEPPER_CDMS) |
| 44 const std::string& pepper_type, |
| 45 #elif defined(OS_ANDROID) |
| 46 const uint8 uuid[16], |
| 47 #endif |
| 48 const std::string& parent_key_system); |
| 49 |
| 50 // Specifies the container and codec combinations supported by |key_system|. |
| 51 // Multiple codecs can be listed. In all cases, the container |
| 52 // without a codec is also supported. |
| 53 // |key_system| must be a concrete supported key system. |
| 54 CONTENT_EXPORT void AddSupportedType(const std::string& key_system, |
| 55 const std::string& mime_type, |
| 56 const std::string& codecs_list); |
| 57 |
35 // Returns whether |key_system| is a real supported key system that can be | 58 // Returns whether |key_system| is a real supported key system that can be |
36 // instantiated. | 59 // instantiated. |
37 // Abstract parent |key_system| strings will return false. | 60 // Abstract parent |key_system| strings will return false. |
38 // Call IsSupportedKeySystemWithMediaMimeType() to determine whether a | 61 // Call IsSupportedKeySystemWithMediaMimeType() to determine whether a |
39 // |key_system| supports a specific type of media or to check parent key | 62 // |key_system| supports a specific type of media or to check parent key |
40 // systems. | 63 // systems. |
41 CONTENT_EXPORT bool IsConcreteSupportedKeySystem( | 64 CONTENT_EXPORT bool IsConcreteSupportedKeySystem( |
42 const WebKit::WebString& key_system); | 65 const WebKit::WebString& key_system); |
43 | 66 |
44 // Returns whether |key_sytem| supports the specified media type and codec(s). | 67 // Returns whether |key_sytem| supports the specified media type and codec(s). |
45 CONTENT_EXPORT bool IsSupportedKeySystemWithMediaMimeType( | 68 CONTENT_EXPORT bool IsSupportedKeySystemWithMediaMimeType( |
46 const std::string& mime_type, | 69 const std::string& mime_type, |
47 const std::vector<std::string>& codecs, | 70 const std::vector<std::string>& codecs, |
48 const std::string& key_system); | 71 const std::string& key_system); |
49 | 72 |
50 // Returns a name for |key_system| suitable to UMA logging. | 73 // Returns a name for |key_system| suitable to UMA logging. |
51 CONTENT_EXPORT std::string KeySystemNameForUMA( | 74 CONTENT_EXPORT std::string KeySystemNameForUMA( |
52 const WebKit::WebString& key_system); | 75 const WebKit::WebString& key_system); |
53 | 76 |
54 // Returns whether AesDecryptor can be used for the given |key_system|. | 77 // Returns whether AesDecryptor can be used for the given |concrete_key_system|. |
55 CONTENT_EXPORT bool CanUseAesDecryptor(const std::string& key_system); | 78 CONTENT_EXPORT bool CanUseAesDecryptor(const std::string& concrete_key_system); |
56 | 79 |
57 #if defined(ENABLE_PEPPER_CDMS) | 80 #if defined(ENABLE_PEPPER_CDMS) |
58 // Returns the Pepper MIME type for |concrete_key_system|. | 81 // Returns the Pepper MIME type for |concrete_key_system|. |
59 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based. | 82 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based. |
60 CONTENT_EXPORT std::string GetPepperType( | 83 CONTENT_EXPORT std::string GetPepperType( |
61 const std::string& concrete_key_system); | 84 const std::string& concrete_key_system); |
62 #endif | 85 #elif defined(OS_ANDROID) |
63 | |
64 #if defined(OS_ANDROID) | |
65 // Convert |concrete_key_system| to 16-byte Android UUID. | 86 // Convert |concrete_key_system| to 16-byte Android UUID. |
66 CONTENT_EXPORT std::vector<uint8> GetUUID( | 87 CONTENT_EXPORT std::vector<uint8> GetUUID( |
67 const std::string& concrete_key_system); | 88 const std::string& concrete_key_system); |
68 #endif | 89 #endif |
69 | 90 |
70 } // namespace content | 91 } // namespace content |
71 | 92 |
72 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ | 93 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ |
OLD | NEW |