Chromium Code Reviews| Index: media/remoting/remoting_cdm.h |
| diff --git a/media/remoting/remoting_cdm.h b/media/remoting/remoting_cdm.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c8840f86406fc3c0653ffe8749475e8b947207b5 |
| --- /dev/null |
| +++ b/media/remoting/remoting_cdm.h |
| @@ -0,0 +1,84 @@ |
| +// Copyright 2016 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 MEDIA_REMOTING_REMOTING_CDM_H_ |
| +#define MEDIA_REMOTING_REMOTING_CDM_H_ |
| + |
| +#include "media/base/cdm_context.h" |
| +#include "media/base/cdm_factory.h" |
| +#include "media/base/media_keys.h" |
| +#include "media/remoting/remoting_controller.h" |
| + |
| +namespace media { |
| + |
| +struct CdmConfig; |
| + |
| +// TODO(xjz): Merge the implementation with Eric's change. |
| +class RemotingCdm : public MediaKeys, public CdmContext { |
| + public: |
| + static void Create( |
| + const std::string& key_system, |
| + const GURL& security_origin, |
| + const CdmConfig& cdm_config, |
| + const SessionMessageCB& session_message_cb, |
| + const SessionClosedCB& session_closed_cb, |
| + const SessionKeysChangeCB& session_keys_change_cb, |
| + const SessionExpirationUpdateCB& session_expiration_update_cb, |
| + const CdmCreatedCB& cdm_created_cb, |
| + std::unique_ptr<RemotingController> remoting_controller); |
| + |
| + // If |cdm| is an instance of RemotingCdm, return a type-casted pointer to it. |
| + // Otherwise, return nullptr. |
| + static RemotingCdm* From(CdmContext* cdm); |
| + |
| + // Pass the ownership of |remoting_controller_| to the caller. |
| + std::unique_ptr<RemotingController> remoting_controller() { |
|
miu
2016/10/08 01:06:16
naming: This isn't an accessor method. So, I'd sug
xjz
2016/10/20 21:25:27
Not applicable.
|
| + return std::move(remoting_controller_); |
| + } |
| + |
| + // MediaKeys implementations. |
| + void SetServerCertificate(const std::vector<uint8_t>& certificate, |
| + std::unique_ptr<SimpleCdmPromise> promise) override; |
| + void CreateSessionAndGenerateRequest( |
| + SessionType session_type, |
| + EmeInitDataType init_data_type, |
| + const std::vector<uint8_t>& init_data, |
| + std::unique_ptr<NewSessionCdmPromise> promise) override; |
| + void LoadSession(SessionType session_type, |
| + const std::string& session_id, |
| + std::unique_ptr<NewSessionCdmPromise> promise) override; |
| + void UpdateSession(const std::string& session_id, |
| + const std::vector<uint8_t>& response, |
| + std::unique_ptr<SimpleCdmPromise> promise) override; |
| + void CloseSession(const std::string& session_id, |
| + std::unique_ptr<SimpleCdmPromise> promise) override; |
| + void RemoveSession(const std::string& session_id, |
| + std::unique_ptr<SimpleCdmPromise> promise) override; |
| + CdmContext* GetCdmContext() override; |
| + |
| + // CdmContext implementations. |
| + Decryptor* GetDecryptor() override; |
| + int GetCdmId() const override; |
| + void* GetClassIdentifier() const override; |
| + |
| + private: |
| + RemotingCdm(const std::string& key_system, |
| + const GURL& security_origin, |
| + const CdmConfig& cdm_config, |
| + const SessionMessageCB& session_message_cb, |
| + const SessionClosedCB& session_closed_cb, |
| + const SessionKeysChangeCB& session_keys_change_cb, |
| + const SessionExpirationUpdateCB& session_expiration_update_cb, |
| + const CdmCreatedCB& cdm_created_cb, |
| + std::unique_ptr<RemotingController> remoting_controller); |
| + ~RemotingCdm() override; |
| + |
| + std::unique_ptr<RemotingController> remoting_controller_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RemotingCdm); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_REMOTING_REMOTING_CDM_H_ |