Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "media/base/media_keys.h" | |
| 13 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | |
| 14 #include "mojo/public/cpp/bindings/interface_impl.h" | |
| 15 | |
| 16 namespace media { | |
| 17 | |
| 18 // A mojo::ContentDecryptionModule implementation backed by a media::MediaKeys. | |
| 19 class MojoCdmService | |
| 20 : public mojo::InterfaceImpl<mojo::ContentDecryptionModule> { | |
| 21 public: | |
| 22 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.
| |
| 23 ~MojoCdmService() final; | |
| 24 | |
| 25 // mojo::ContentDecryptionModule implementation. | |
| 26 void SetServerCertificate( | |
| 27 mojo::Array<uint8_t> certificate_data, | |
| 28 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; | |
| 29 void CreateSession(const mojo::String& init_data_type, | |
| 30 mojo::Array<uint8_t> init_data, | |
| 31 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.
| |
| 32 const mojo::Callback<void(mojo::CdmPromiseResultPtr, | |
| 33 mojo::String)>& callback) final; | |
| 34 void LoadSession(const mojo::String& session_id, | |
| 35 const mojo::Callback<void(mojo::CdmPromiseResultPtr, | |
| 36 mojo::String)>& callback) final; | |
| 37 void UpdateSession( | |
| 38 const mojo::String& session_id, | |
| 39 mojo::Array<uint8_t> response, | |
| 40 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; | |
| 41 void CloseSession( | |
| 42 const mojo::String& session_id, | |
| 43 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; | |
| 44 void RemoveSession( | |
| 45 const mojo::String& session_id, | |
| 46 const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; | |
| 47 void GetUsableKeyIds( | |
| 48 const mojo::String& session_id, | |
| 49 const mojo::Callback<void(mojo::CdmPromiseResultPtr, | |
| 50 mojo::Array<mojo::Array<uint8_t>>)>& callback) | |
| 51 final; | |
| 52 void GetCdmContext( | |
| 53 mojo::InterfaceRequest<mojo::CdmContext> cdm_context) final; | |
| 54 | |
| 55 private: | |
| 56 // Callbacks for firing session events. | |
| 57 void OnSessionMessage(const std::string& session_id, | |
| 58 const std::vector<uint8>& message, | |
| 59 const GURL& destination_url); | |
| 60 void OnSessionKeysChange(const std::string& session_id, | |
| 61 bool has_additional_usable_key); | |
| 62 void OnSessionExpirationUpdate(const std::string& session_id, | |
| 63 const base::Time& new_expiry_time); | |
| 64 void OnSessionReady(const std::string& session_id); | |
| 65 void OnSessionClosed(const std::string& session_id); | |
| 66 void OnSessionError(const std::string& session_id, | |
| 67 MediaKeys::Exception exception_code, | |
| 68 uint32 system_code, | |
| 69 const std::string& error_message); | |
| 70 | |
| 71 scoped_ptr<MediaKeys> cdm_; | |
| 72 | |
| 73 base::WeakPtrFactory<MojoCdmService> weak_factory_; | |
| 74 base::WeakPtr<MojoCdmService> weak_this_; | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(MojoCdmService); | |
| 77 }; | |
| 78 | |
| 79 } // namespace media | |
| 80 | |
| 81 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_H_ | |
| OLD | NEW |