| Index: content/renderer/media/crypto/encrypted_media_support_impl.h
|
| diff --git a/content/renderer/media/crypto/encrypted_media_support_impl.h b/content/renderer/media/crypto/encrypted_media_support_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..00eb619a691267afccc2e095117d5f865e4979fc
|
| --- /dev/null
|
| +++ b/content/renderer/media/crypto/encrypted_media_support_impl.h
|
| @@ -0,0 +1,119 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_SUPPORT_IMPL_H_
|
| +#define CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_SUPPORT_IMPL_H_
|
| +
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "content/renderer/media/crypto/encrypted_media_support.h"
|
| +#include "content/renderer/media/crypto/proxy_decryptor.h"
|
| +
|
| +namespace content {
|
| +
|
| +class WebContentDecryptionModuleImpl;
|
| +
|
| +class EncryptedMediaSupportImpl
|
| + : public EncryptedMediaSupport,
|
| + public base::SupportsWeakPtr<EncryptedMediaSupportImpl> {
|
| + public:
|
| + explicit EncryptedMediaSupportImpl(blink::WebMediaPlayerClient* client);
|
| + virtual ~EncryptedMediaSupportImpl();
|
| +
|
| + // EncryptedMediaSupport implementation.
|
| + virtual blink::WebMediaPlayer::MediaKeyException generateKeyRequest(
|
| + blink::WebLocalFrame* frame,
|
| + const blink::WebString& key_system,
|
| + const unsigned char* init_data,
|
| + unsigned init_data_length) OVERRIDE;
|
| +
|
| + virtual blink::WebMediaPlayer::MediaKeyException addKey(
|
| + const blink::WebString& key_system,
|
| + const unsigned char* key,
|
| + unsigned key_length,
|
| + const unsigned char* init_data,
|
| + unsigned init_data_length,
|
| + const blink::WebString& session_id) OVERRIDE;
|
| +
|
| + virtual blink::WebMediaPlayer::MediaKeyException cancelKeyRequest(
|
| + const blink::WebString& key_system,
|
| + const blink::WebString& session_id) OVERRIDE;
|
| +
|
| + virtual void setContentDecryptionModule(
|
| + blink::WebContentDecryptionModule* cdm) OVERRIDE;
|
| + virtual void setContentDecryptionModule(
|
| + blink::WebContentDecryptionModule* cdm,
|
| + blink::WebContentDecryptionModuleResult result) OVERRIDE;
|
| + virtual void setContentDecryptionModuleSync(
|
| + blink::WebContentDecryptionModule* cdm) OVERRIDE;
|
| +
|
| + virtual media::SetDecryptorReadyCB CreateSetDecryptorReadyCB() OVERRIDE;
|
| + virtual media::Demuxer::NeedKeyCB CreateNeedKeyCB() OVERRIDE;
|
| +
|
| + virtual void OnDecryptError() OVERRIDE;
|
| +
|
| + private:
|
| + // Requests that this object notifies when a decryptor is ready through the
|
| + // |decryptor_ready_cb| provided.
|
| + // If |decryptor_ready_cb| is null, the existing callback will be fired with
|
| + // NULL immediately and reset.
|
| + void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb);
|
| +
|
| + blink::WebMediaPlayer::MediaKeyException GenerateKeyRequestInternal(
|
| + blink::WebLocalFrame* frame,
|
| + const std::string& key_system,
|
| + const unsigned char* init_data,
|
| + unsigned init_data_length);
|
| +
|
| + blink::WebMediaPlayer::MediaKeyException AddKeyInternal(
|
| + const std::string& key_system,
|
| + const unsigned char* key,
|
| + unsigned key_length,
|
| + const unsigned char* init_data,
|
| + unsigned init_data_length,
|
| + const std::string& session_id);
|
| +
|
| + blink::WebMediaPlayer::MediaKeyException CancelKeyRequestInternal(
|
| + const std::string& key_system,
|
| + const std::string& session_id);
|
| +
|
| + void OnNeedKey(const std::string& type,
|
| + const std::vector<uint8>& init_data);
|
| +
|
| + void OnKeyAdded(const std::string& session_id);
|
| + void OnKeyError(const std::string& session_id,
|
| + media::MediaKeys::KeyError error_code,
|
| + uint32 system_code);
|
| + void OnKeyMessage(const std::string& session_id,
|
| + const std::vector<uint8>& message,
|
| + const GURL& destination_url);
|
| +
|
| + void ContentDecryptionModuleAttached(
|
| + blink::WebContentDecryptionModuleResult result,
|
| + bool success);
|
| +
|
| + blink::WebMediaPlayerClient* client_;
|
| +
|
| + // The currently selected key system. Empty string means that no key system
|
| + // has been selected.
|
| + std::string current_key_system_;
|
| +
|
| + // Temporary for EME v0.1. In the future the init data type should be passed
|
| + // through GenerateKeyRequest() directly from WebKit.
|
| + std::string init_data_type_;
|
| +
|
| + // Manages decryption keys and decrypts encrypted frames.
|
| + scoped_ptr<ProxyDecryptor> proxy_decryptor_;
|
| +
|
| + // Non-owned pointer to the CDM. Updated via calls to
|
| + // setContentDecryptionModule().
|
| + WebContentDecryptionModuleImpl* web_cdm_;
|
| +
|
| + media::DecryptorReadyCB decryptor_ready_cb_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(EncryptedMediaSupportImpl);
|
| +};
|
| +
|
| +}
|
| +
|
| +#endif // CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_SUPPORT_IMPL_H_
|
|
|