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