Source release 14.2.0
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
// source code may only be used and distributed under the Widevine Master
|
||||
// License Agreement.
|
||||
|
||||
#ifndef WVCDM_CORE_CRYPTO_SESSSION_H_
|
||||
#define WVCDM_CORE_CRYPTO_SESSSION_H_
|
||||
#ifndef WVCDM_CORE_CRYPTO_SESSION_H_
|
||||
#define WVCDM_CORE_CRYPTO_SESSION_H_
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
@@ -34,6 +34,8 @@ void GenerateEncryptContext(const std::string& input_context,
|
||||
size_t GetOffset(std::string message, std::string field);
|
||||
OEMCryptoCipherMode ToOEMCryptoCipherMode(CdmCipherMode cipher_mode);
|
||||
|
||||
class CryptoSessionFactory;
|
||||
|
||||
class CryptoSession {
|
||||
public:
|
||||
typedef OEMCrypto_HDCP_Capability HdcpCapability;
|
||||
@@ -52,7 +54,9 @@ class CryptoSession {
|
||||
// Creates an instance of CryptoSession with the given |crypto_metrics|.
|
||||
// |crypto_metrics| is owned by the caller, must NOT be null, and must
|
||||
// exist as long as the new CryptoSession exists.
|
||||
explicit CryptoSession(metrics::CryptoMetrics* crypto_metrics);
|
||||
static CryptoSession* MakeCryptoSession(
|
||||
metrics::CryptoMetrics* crypto_metrics);
|
||||
|
||||
virtual ~CryptoSession();
|
||||
|
||||
virtual bool GetProvisioningToken(std::string* client_token);
|
||||
@@ -203,8 +207,26 @@ class CryptoSession {
|
||||
SecurityLevel requested_security_level,
|
||||
CdmClientTokenType* token_type);
|
||||
|
||||
protected:
|
||||
// Creates an instance of CryptoSession with the given |crypto_metrics|.
|
||||
// |crypto_metrics| is owned by the caller, must NOT be null, and must
|
||||
// exist as long as the new CryptoSession exists.
|
||||
explicit CryptoSession(metrics::CryptoMetrics* crypto_metrics);
|
||||
|
||||
int session_count() { return session_count_; }
|
||||
|
||||
private:
|
||||
friend class CryptoSessionForTest;
|
||||
friend class CryptoSessionFactory;
|
||||
friend class WvCdmTestBase;
|
||||
|
||||
// The global factory method can be set to generate special crypto sessions
|
||||
// just for testing. These sessions will avoid nonce floods and will ask
|
||||
// OEMCrypto to use a test keybox.
|
||||
// Ownership of the object is transfered to CryptoSession.
|
||||
static void SetCryptoSessionFactory(CryptoSessionFactory* factory) {
|
||||
factory_.reset(factory);
|
||||
}
|
||||
|
||||
void Init();
|
||||
void Terminate();
|
||||
@@ -291,9 +313,25 @@ class CryptoSession {
|
||||
CdmCipherMode cipher_mode_;
|
||||
uint32_t api_version_;
|
||||
|
||||
static scoped_ptr<CryptoSessionFactory> factory_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoSession);
|
||||
};
|
||||
|
||||
class CryptoSessionFactory {
|
||||
public:
|
||||
virtual ~CryptoSessionFactory() {}
|
||||
virtual CryptoSession* MakeCryptoSession(
|
||||
metrics::CryptoMetrics* crypto_metrics);
|
||||
|
||||
protected:
|
||||
friend class CryptoSession;
|
||||
CryptoSessionFactory() {}
|
||||
|
||||
private:
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoSessionFactory);
|
||||
};
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_CRYPTO_SESSSION_H_
|
||||
#endif // WVCDM_CORE_CRYPTO_SESSION_H_
|
||||
|
||||
Reference in New Issue
Block a user