Index: media/remoting/remoting_cdm.h |
diff --git a/media/mojo/clients/mojo_cdm_factory.h b/media/remoting/remoting_cdm.h |
similarity index 20% |
copy from media/mojo/clients/mojo_cdm_factory.h |
copy to media/remoting/remoting_cdm.h |
index 41561623035da0f7ccb442beaf09adc9bf0a8560..7be8fb088c4363da41011ad750a3262391f3e4c4 100644 |
--- a/media/mojo/clients/mojo_cdm_factory.h |
+++ b/media/remoting/remoting_cdm.h |
@@ -1,43 +1,68 @@ |
-// Copyright 2015 The Chromium Authors. All rights reserved. |
+// 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_MOJO_CLIENTS_MOJO_CDM_FACTORY_H_ |
-#define MEDIA_MOJO_CLIENTS_MOJO_CDM_FACTORY_H_ |
+#ifndef MEDIA_REMOTING_REMOTING_CDM_H_ |
+#define MEDIA_REMOTING_REMOTING_CDM_H_ |
-#include "base/macros.h" |
+#include "media/base/cdm_context.h" |
#include "media/base/cdm_factory.h" |
- |
-namespace service_manager { |
-namespace mojom { |
-class InterfaceProvider; |
-} |
-} |
+#include "media/base/media_keys.h" |
+#include "media/remoting/remoting_cdm_controller.h" |
namespace media { |
-class MojoCdmFactory : public CdmFactory { |
+// TODO(xjz): Merge this with Eric's implementation. |
+class RemotingCdm : public MediaKeys, public CdmContext { |
public: |
- explicit MojoCdmFactory( |
- service_manager::mojom::InterfaceProvider* interface_provider); |
- ~MojoCdmFactory() final; |
- |
- // CdmFactory implementation. |
- void Create(const std::string& key_system, |
+ 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) final; |
+ const CdmCreatedCB& cdm_created_cb, |
+ std::unique_ptr<RemotingCdmController> remoting_controller); |
+ |
+ // If |cdm| is an instance of RemotingCdm, return a type-casted pointer to it. |
+ // Otherwise, return nullptr. |
+ static RemotingCdm* From(CdmContext* cdm); |
+ |
+ RemotingSourceImpl* GetRemotingSource(); |
+ |
+ // 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: |
- service_manager::mojom::InterfaceProvider* interface_provider_; |
+ ~RemotingCdm() override; |
+ const std::unique_ptr<RemotingCdmController> remoting_controller_; |
- DISALLOW_COPY_AND_ASSIGN(MojoCdmFactory); |
+ DISALLOW_COPY_AND_ASSIGN(RemotingCdm); |
}; |
} // namespace media |
-#endif // MEDIA_MOJO_CLIENTS_MOJO_CDM_FACTORY_H_ |
+#endif // MEDIA_REMOTING_REMOTING_CDM_H_ |