| 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_CONTEXT_H_ | 5 #ifndef MEDIA_REMOTING_REMOTING_CDM_CONTEXT_H_ |
| 6 #define MEDIA_REMOTING_REMOTING_CDM_CONTEXT_H_ | 6 #define MEDIA_REMOTING_REMOTING_CDM_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "media/base/cdm_context.h" | 8 #include "media/base/cdm_context.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| 11 namespace remoting { |
| 11 | 12 |
| 12 class RemotingCdm; | 13 class RemotingCdm; |
| 13 class RemotingSourceImpl; | 14 class SharedSession; |
| 14 | 15 |
| 15 // TODO(xjz): Merge this with erickung's implementation. | 16 // TODO(xjz): Merge this with erickung's implementation. |
| 17 // TODO(miu): This class should just be merged into RemotingCdm and implement |
| 18 // both the CDM and CdmContext interfaces. Also, replace the GetSharedSession() |
| 19 // accessor and move it to a new SharedSession::FromCdmContext() function. Then, |
| 20 // neither the controller nor renderer can gain direct access to the CDM impl. |
| 21 // See discussion in https://codereview.chromium.org/2643253003 for more info. |
| 16 class RemotingCdmContext : public CdmContext { | 22 class RemotingCdmContext : public CdmContext { |
| 17 public: | 23 public: |
| 18 explicit RemotingCdmContext(RemotingCdm* remoting_cdm); | 24 explicit RemotingCdmContext(RemotingCdm* remoting_cdm); |
| 19 ~RemotingCdmContext() override; | 25 ~RemotingCdmContext() override; |
| 20 | 26 |
| 21 // If |cdm_context| is an instance of RemotingCdmContext, return a type-casted | 27 // If |cdm_context| is an instance of RemotingCdmContext, return a type-casted |
| 22 // pointer to it. Otherwise, return nullptr. | 28 // pointer to it. Otherwise, return nullptr. |
| 23 static RemotingCdmContext* From(CdmContext* cdm_context); | 29 static RemotingCdmContext* From(CdmContext* cdm_context); |
| 24 | 30 |
| 25 RemotingSourceImpl* GetRemotingSource(); | 31 SharedSession* GetSharedSession() const; |
| 26 | 32 |
| 27 // CdmContext implementations. | 33 // CdmContext implementations. |
| 28 Decryptor* GetDecryptor() override; | 34 Decryptor* GetDecryptor() override; |
| 29 int GetCdmId() const override; | 35 int GetCdmId() const override; |
| 30 void* GetClassIdentifier() const override; | 36 void* GetClassIdentifier() const override; |
| 31 | 37 |
| 32 private: | 38 private: |
| 33 RemotingCdm* const remoting_cdm_; // Outlives this class. | 39 RemotingCdm* const remoting_cdm_; // Outlives this class. |
| 34 | 40 |
| 35 DISALLOW_COPY_AND_ASSIGN(RemotingCdmContext); | 41 DISALLOW_COPY_AND_ASSIGN(RemotingCdmContext); |
| 36 }; | 42 }; |
| 37 | 43 |
| 44 } // namespace remoting |
| 38 } // namespace media | 45 } // namespace media |
| 39 | 46 |
| 40 #endif // MEDIA_REMOTING_REMOTING_CDM_CONTEXT_H_ | 47 #endif // MEDIA_REMOTING_REMOTING_CDM_CONTEXT_H_ |
| OLD | NEW |