| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_BLINK_CDM_SESSION_ADAPTER_H_ | 5 #ifndef MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ |
| 6 #define MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ | 6 #define MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "media/base/media_keys.h" | 16 #include "media/base/media_keys.h" |
| 17 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 17 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
| 18 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h
" | 18 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h
" |
| 19 | 19 |
| 20 class GURL; | 20 class GURL; |
| 21 | 21 |
| 22 namespace media { | 22 namespace media { |
| 23 | 23 |
| 24 struct CdmConfig; |
| 24 class CdmFactory; | 25 class CdmFactory; |
| 25 class WebContentDecryptionModuleSessionImpl; | 26 class WebContentDecryptionModuleSessionImpl; |
| 26 | 27 |
| 27 // Owns the CDM instance and makes calls from session objects to the CDM. | 28 // Owns the CDM instance and makes calls from session objects to the CDM. |
| 28 // Forwards the session ID-based callbacks of the MediaKeys interface to the | 29 // Forwards the session ID-based callbacks of the MediaKeys interface to the |
| 29 // appropriate session object. Callers should hold references to this class | 30 // appropriate session object. Callers should hold references to this class |
| 30 // as long as they need the CDM instance. | 31 // as long as they need the CDM instance. |
| 31 class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> { | 32 class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> { |
| 32 public: | 33 public: |
| 33 CdmSessionAdapter(); | 34 CdmSessionAdapter(); |
| 34 | 35 |
| 35 // Creates the CDM for |key_system| using |cdm_factory| and returns the result | 36 // Creates the CDM for |key_system| using |cdm_factory| and returns the result |
| 36 // via |result|. | 37 // via |result|. |
| 37 void CreateCdm(CdmFactory* cdm_factory, | 38 void CreateCdm(CdmFactory* cdm_factory, |
| 38 const std::string& key_system, | 39 const std::string& key_system, |
| 39 bool allow_distinctive_identifier, | |
| 40 bool allow_persistent_state, | |
| 41 const GURL& security_origin, | 40 const GURL& security_origin, |
| 41 const CdmConfig& cdm_config, |
| 42 blink::WebContentDecryptionModuleResult result); | 42 blink::WebContentDecryptionModuleResult result); |
| 43 | 43 |
| 44 // Provides a server certificate to be used to encrypt messages to the | 44 // Provides a server certificate to be used to encrypt messages to the |
| 45 // license server. | 45 // license server. |
| 46 void SetServerCertificate(const std::vector<uint8_t>& certificate, | 46 void SetServerCertificate(const std::vector<uint8_t>& certificate, |
| 47 scoped_ptr<SimpleCdmPromise> promise); | 47 scoped_ptr<SimpleCdmPromise> promise); |
| 48 | 48 |
| 49 // Creates a new session and adds it to the internal map. The caller owns the | 49 // Creates a new session and adds it to the internal map. The caller owns the |
| 50 // created session. RemoveSession() must be called when destroying it, if | 50 // created session. RemoveSession() must be called when destroying it, if |
| 51 // RegisterSession() was called. | 51 // RegisterSession() was called. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 // NOTE: Weak pointers must be invalidated before all other member variables. | 144 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 145 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; | 145 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; |
| 146 | 146 |
| 147 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); | 147 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 } // namespace media | 150 } // namespace media |
| 151 | 151 |
| 152 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ | 152 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ |
| OLD | NEW |