#ifndef CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_
#define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "media/base/media_keys.h"
#include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h"
#include "third_party/WebKit/public/platform/WebString.h"
namespace media {
class MediaKeys;
}
namespace content {
class CdmSessionAdapter;
class WebContentDecryptionModuleSessionImpl
: public blink::WebContentDecryptionModuleSession {
public:
WebContentDecryptionModuleSessionImpl(
uint32 session_id,
Client* client,
const scoped_refptr<CdmSessionAdapter>& adapter);
virtual ~WebContentDecryptionModuleSessionImpl();
virtual blink::WebString sessionId() const;
virtual void initializeNewSession(const blink::WebString& mime_type,
const uint8* init_data,
size_t init_data_length);
virtual void update(const uint8* response, size_t response_length);
virtual void release();
void OnSessionCreated(const std::string& web_session_id);
void OnSessionMessage(const std::vector<uint8>& message,
const std::string& destination_url);
void OnSessionReady();
void OnSessionClosed();
void OnSessionError(media::MediaKeys::KeyError error_code,
uint32 system_code);
private:
scoped_refptr<CdmSessionAdapter> adapter_;
Client* client_;
blink::WebString web_session_id_;
const uint32 session_id_;
DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl);
};
}
#endif