Chromium Code Reviews| Index: media/mojo/services/mojo_cdm_service.h |
| diff --git a/media/mojo/services/mojo_cdm_service.h b/media/mojo/services/mojo_cdm_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dc1146ba38ab583b32cf753761af6d018980155b |
| --- /dev/null |
| +++ b/media/mojo/services/mojo_cdm_service.h |
| @@ -0,0 +1,81 @@ |
| +// 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 MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |
| +#define MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "media/base/media_keys.h" |
| +#include "media/mojo/interfaces/content_decryption_module.mojom.h" |
| +#include "mojo/public/cpp/bindings/interface_impl.h" |
| + |
| +namespace media { |
| + |
| +// A mojo::ContentDecryptionModule implementation backed by a media::MediaKeys. |
| +class MojoCdmService |
| + : public mojo::InterfaceImpl<mojo::ContentDecryptionModule> { |
| + public: |
| + MojoCdmService(const mojo::String& key_system); |
|
ddorwin
2014/12/08 23:46:49
FYI, We may need more information eventually. For
xhwang
2014/12/10 04:59:16
Acknowledged.
|
| + ~MojoCdmService() final; |
| + |
| + // mojo::ContentDecryptionModule implementation. |
| + void SetServerCertificate( |
| + mojo::Array<uint8_t> certificate_data, |
| + const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; |
| + void CreateSession(const mojo::String& init_data_type, |
| + mojo::Array<uint8_t> init_data, |
| + ContentDecryptionModule::SessionType session_type, |
|
ddorwin
2014/12/08 23:46:49
Lots of ditto from the previous file. :)
xhwang
2014/12/10 04:59:16
Acknowledged.
|
| + const mojo::Callback<void(mojo::CdmPromiseResultPtr, |
| + mojo::String)>& callback) final; |
| + void LoadSession(const mojo::String& session_id, |
| + const mojo::Callback<void(mojo::CdmPromiseResultPtr, |
| + mojo::String)>& callback) final; |
| + void UpdateSession( |
| + const mojo::String& session_id, |
| + mojo::Array<uint8_t> response, |
| + const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; |
| + void CloseSession( |
| + const mojo::String& session_id, |
| + const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; |
| + void RemoveSession( |
| + const mojo::String& session_id, |
| + const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; |
| + void GetUsableKeyIds( |
| + const mojo::String& session_id, |
| + const mojo::Callback<void(mojo::CdmPromiseResultPtr, |
| + mojo::Array<mojo::Array<uint8_t>>)>& callback) |
| + final; |
| + void GetCdmContext( |
| + mojo::InterfaceRequest<mojo::CdmContext> cdm_context) final; |
| + |
| + private: |
| + // Callbacks for firing session events. |
| + void OnSessionMessage(const std::string& session_id, |
| + const std::vector<uint8>& message, |
| + const GURL& destination_url); |
| + void OnSessionKeysChange(const std::string& session_id, |
| + bool has_additional_usable_key); |
| + void OnSessionExpirationUpdate(const std::string& session_id, |
| + const base::Time& new_expiry_time); |
| + void OnSessionReady(const std::string& session_id); |
| + void OnSessionClosed(const std::string& session_id); |
| + void OnSessionError(const std::string& session_id, |
| + MediaKeys::Exception exception_code, |
| + uint32 system_code, |
| + const std::string& error_message); |
| + |
| + scoped_ptr<MediaKeys> cdm_; |
| + |
| + base::WeakPtrFactory<MojoCdmService> weak_factory_; |
| + base::WeakPtr<MojoCdmService> weak_this_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MojoCdmService); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ |