OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_REMOTING_REMOTING_CDM_FACTORY_H_ |
| 6 #define MEDIA_REMOTING_REMOTING_CDM_FACTORY_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "media/base/cdm_factory.h" |
| 10 #include "media/mojo/interfaces/remoting.mojom.h" |
| 11 #include "media/remoting/remoting_cdm_controller.h" |
| 12 #include "media/remoting/remoting_sink_observer.h" |
| 13 |
| 14 namespace media { |
| 15 |
| 16 // TODO(xjz): Merge this with Eric's implementation. |
| 17 class RemotingCdmFactory : public CdmFactory { |
| 18 public: |
| 19 // |remoter_factory| is expected to outlive this class. |
| 20 // |sink_observer| monitors the remoting sink availablity, which is used to |
| 21 // initialize RemotingSourceImpl when created to avoid possible delay of |
| 22 // OnSinkAvailable() call from browser. |
| 23 RemotingCdmFactory(std::unique_ptr<CdmFactory> default_cdm_factory, |
| 24 mojom::RemoterFactory* remoter_factory, |
| 25 std::unique_ptr<RemotingSinkObserver> sink_observer); |
| 26 ~RemotingCdmFactory() override; |
| 27 |
| 28 void Create(const std::string& key_system, |
| 29 const GURL& security_origin, |
| 30 const CdmConfig& cdm_config, |
| 31 const SessionMessageCB& session_message_cb, |
| 32 const SessionClosedCB& session_closed_cb, |
| 33 const SessionKeysChangeCB& session_keys_change_cb, |
| 34 const SessionExpirationUpdateCB& session_expiration_update_cb, |
| 35 const CdmCreatedCB& cdm_created_cb) override; |
| 36 |
| 37 private: |
| 38 std::unique_ptr<RemotingCdmController> CreateRemotingCdmController(); |
| 39 void CreateCdm(const std::string& key_system, |
| 40 const GURL& security_origin, |
| 41 const CdmConfig& cdm_config, |
| 42 const SessionMessageCB& session_message_cb, |
| 43 const SessionClosedCB& session_closed_cb, |
| 44 const SessionKeysChangeCB& session_keys_change_cb, |
| 45 const SessionExpirationUpdateCB& session_expiration_update_cb, |
| 46 const CdmCreatedCB& cdm_created_cb, |
| 47 std::unique_ptr<RemotingCdmController> remoting_cdm_controller, |
| 48 bool is_remoting); |
| 49 |
| 50 const std::unique_ptr<CdmFactory> default_cdm_factory_; |
| 51 mojom::RemoterFactory* const remoter_factory_; // Outlives this class. |
| 52 std::unique_ptr<RemotingSinkObserver> sink_observer_; |
| 53 base::WeakPtrFactory<RemotingCdmFactory> weak_factory_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(RemotingCdmFactory); |
| 56 }; |
| 57 |
| 58 } // namespace media |
| 59 |
| 60 #endif // MEDIA_REMOTING_REMOTING_CDM_FACTORY_H_ |
OLD | NEW |