| 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 |concrete_key_system|. |
| 38 // When not empty, |parent_key_system| will add a mapping to the |
| 39 // |concrete_key_system| that can be used to check supported types. |
| 40 // Only one parent key system is currently supported per concrete key system. |
| 41 CONTENT_EXPORT void AddConcreteSupportedKeySystem( |
| 42 const std::string& concrete_key_system, |
| 43 bool use_aes_decryptor, |
| 44 #if defined(ENABLE_PEPPER_CDMS) |
| 45 const std::string& pepper_type, |
| 46 #elif defined(OS_ANDROID) |
| 47 const uint8 uuid[16], |
| 48 #endif |
| 49 const std::string& parent_key_system); |
| 50 |
| 51 // Specifies the container and codec combinations supported by |
| 52 // |concrete_key_system|. |
| 53 // Multiple codecs can be listed. In all cases, the container |
| 54 // without a codec is also supported. |
| 55 // |concrete_key_system| must be a concrete supported key system previously |
| 56 // added using AddConcreteSupportedKeySystem(). |
| 57 CONTENT_EXPORT void AddSupportedType(const std::string& concrete_key_system, |
| 58 const std::string& mime_type, |
| 59 const std::string& codecs_list); |
| 60 |
| 35 // Returns whether |key_system| is a real supported key system that can be | 61 // Returns whether |key_system| is a real supported key system that can be |
| 36 // instantiated. | 62 // instantiated. |
| 37 // Abstract parent |key_system| strings will return false. | 63 // Abstract parent |key_system| strings will return false. |
| 38 // Call IsSupportedKeySystemWithMediaMimeType() to determine whether a | 64 // Call IsSupportedKeySystemWithMediaMimeType() to determine whether a |
| 39 // |key_system| supports a specific type of media or to check parent key | 65 // |key_system| supports a specific type of media or to check parent key |
| 40 // systems. | 66 // systems. |
| 41 CONTENT_EXPORT bool IsConcreteSupportedKeySystem( | 67 CONTENT_EXPORT bool IsConcreteSupportedKeySystem( |
| 42 const WebKit::WebString& key_system); | 68 const WebKit::WebString& key_system); |
| 43 | 69 |
| 44 // Returns whether |key_sytem| supports the specified media type and codec(s). | 70 // Returns whether |key_sytem| supports the specified media type and codec(s). |
| 45 CONTENT_EXPORT bool IsSupportedKeySystemWithMediaMimeType( | 71 CONTENT_EXPORT bool IsSupportedKeySystemWithMediaMimeType( |
| 46 const std::string& mime_type, | 72 const std::string& mime_type, |
| 47 const std::vector<std::string>& codecs, | 73 const std::vector<std::string>& codecs, |
| 48 const std::string& key_system); | 74 const std::string& key_system); |
| 49 | 75 |
| 50 // Returns a name for |key_system| suitable to UMA logging. | 76 // Returns a name for |key_system| suitable to UMA logging. |
| 51 CONTENT_EXPORT std::string KeySystemNameForUMA( | 77 CONTENT_EXPORT std::string KeySystemNameForUMA( |
| 52 const WebKit::WebString& key_system); | 78 const WebKit::WebString& key_system); |
| 53 | 79 |
| 54 // Returns whether AesDecryptor can be used for the given |key_system|. | 80 // Returns whether AesDecryptor can be used for the given |concrete_key_system|. |
| 55 CONTENT_EXPORT bool CanUseAesDecryptor(const std::string& key_system); | 81 CONTENT_EXPORT bool CanUseAesDecryptor(const std::string& concrete_key_system); |
| 56 | 82 |
| 57 #if defined(ENABLE_PEPPER_CDMS) | 83 #if defined(ENABLE_PEPPER_CDMS) |
| 58 // Returns the Pepper MIME type for |concrete_key_system|. | 84 // Returns the Pepper MIME type for |concrete_key_system|. |
| 59 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based. | 85 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based. |
| 60 CONTENT_EXPORT std::string GetPepperType( | 86 CONTENT_EXPORT std::string GetPepperType( |
| 61 const std::string& concrete_key_system); | 87 const std::string& concrete_key_system); |
| 62 #endif | 88 #elif defined(OS_ANDROID) |
| 63 | |
| 64 #if defined(OS_ANDROID) | |
| 65 // Convert |concrete_key_system| to 16-byte Android UUID. | 89 // Convert |concrete_key_system| to 16-byte Android UUID. |
| 66 CONTENT_EXPORT std::vector<uint8> GetUUID( | 90 CONTENT_EXPORT std::vector<uint8> GetUUID( |
| 67 const std::string& concrete_key_system); | 91 const std::string& concrete_key_system); |
| 68 #endif | 92 #endif |
| 69 | 93 |
| 70 } // namespace content | 94 } // namespace content |
| 71 | 95 |
| 72 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ | 96 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ |
| OLD | NEW |