Chromium Code Reviews| Index: media/remoting/remoting_cdm.cc |
| diff --git a/media/remoting/remoting_cdm.cc b/media/remoting/remoting_cdm.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..abfadda0c3cd90544d9c244f24d141d4b0a3ef78 |
| --- /dev/null |
| +++ b/media/remoting/remoting_cdm.cc |
| @@ -0,0 +1,117 @@ |
| +// 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. |
| + |
| +#include "media/remoting/remoting_cdm.h" |
| + |
| +#include "base/logging.h" |
| +#include "media/base/cdm_config.h" |
| +#include "media/base/cdm_promise.h" |
| + |
| +namespace media { |
| + |
| +namespace { |
| +// Used as an identifier for RemotingCdm::From(). |
| +void* const kClassIdentifier = const_cast<void**>(&kClassIdentifier); |
| +} // namespace |
| + |
| +void RemotingCdm::Create( |
|
miu
2016/10/08 01:06:16
This function is not necessary. Clients can just i
xjz
2016/10/20 21:25:27
Done.
|
| + 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) { |
| + // TODO(xjz): Merge with Eric's implementation to create remoting CDM. |
| + new RemotingCdm(key_system, security_origin, cdm_config, session_message_cb, |
| + session_closed_cb, session_keys_change_cb, |
| + session_expiration_update_cb, cdm_created_cb, |
| + std::move(remoting_controller)); |
| +} |
| + |
| +RemotingCdm::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) { |
| + // TODO(xjz): Merge with Eric's implementation. |
| + NOTIMPLEMENTED(); |
| +} |
| + |
| +RemotingCdm::~RemotingCdm() {} |
| + |
| +RemotingCdm* RemotingCdm::From(CdmContext* cdm) { |
| + if (cdm && cdm->GetClassIdentifier() == kClassIdentifier) |
| + return static_cast<RemotingCdm*>(cdm); |
| + return nullptr; |
| +} |
| + |
| +void RemotingCdm::SetServerCertificate( |
| + const std::vector<uint8_t>& certificate, |
| + std::unique_ptr<SimpleCdmPromise> promise) { |
| + // TODO(xjz): Merge with Eric's implementation. |
| + NOTIMPLEMENTED(); |
| +} |
| + |
| +void RemotingCdm::CreateSessionAndGenerateRequest( |
| + SessionType session_type, |
| + EmeInitDataType init_data_type, |
| + const std::vector<uint8_t>& init_data, |
| + std::unique_ptr<NewSessionCdmPromise> promise) { |
| + // TODO(xjz): Merge with Eric's implementation. |
| + NOTIMPLEMENTED(); |
| +} |
| + |
| +void RemotingCdm::LoadSession(SessionType session_type, |
| + const std::string& session_id, |
| + std::unique_ptr<NewSessionCdmPromise> promise) { |
| + // TODO(xjz): Merge with Eric's implementation. |
| + NOTIMPLEMENTED(); |
| +} |
| + |
| +void RemotingCdm::UpdateSession(const std::string& session_id, |
| + const std::vector<uint8_t>& response, |
| + std::unique_ptr<SimpleCdmPromise> promise) { |
| + // TODO(xjz): Merge with Eric's implementation. |
| + NOTIMPLEMENTED(); |
| +} |
| + |
| +void RemotingCdm::CloseSession(const std::string& session_id, |
| + std::unique_ptr<SimpleCdmPromise> promise) { |
| + // TODO(xjz): Merge with Eric's implementation. |
| + NOTIMPLEMENTED(); |
| +} |
| + |
| +void RemotingCdm::RemoveSession(const std::string& session_id, |
| + std::unique_ptr<SimpleCdmPromise> promise) { |
| + // TODO(xjz): Merge with Eric's implementation. |
| + NOTIMPLEMENTED(); |
| +} |
| + |
| +CdmContext* RemotingCdm::GetCdmContext() { |
| + return this; |
| +} |
| + |
| +Decryptor* RemotingCdm::GetDecryptor() { |
| + // TODO(xjz): Merge with Eric's implementation. |
| + return nullptr; |
| +} |
| + |
| +int RemotingCdm::GetCdmId() const { |
| + // TODO(xjz): Merge with Eric's implementation. |
| + return CdmContext::kInvalidCdmId; |
| +} |
| + |
| +void* RemotingCdm::GetClassIdentifier() const { |
| + return kClassIdentifier; |
| +} |
| + |
| +} // namespace media |