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 CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ |
6 #define CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ | 6 #define CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "media/base/media_keys.h" | 15 #include "media/base/media_keys.h" |
16 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h
" | 16 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h
" |
17 | 17 |
18 #if defined(ENABLE_PEPPER_CDMS) | 18 class GURL; |
19 #include "content/renderer/media/crypto/pepper_cdm_wrapper.h" | |
20 #endif | |
21 | 19 |
22 class GURL; | 20 namespace media { |
| 21 class CdmFactory; |
| 22 } |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 #if defined(ENABLE_BROWSER_CDMS) | |
27 class RendererCdmManager; | |
28 #endif | |
29 | |
30 class WebContentDecryptionModuleSessionImpl; | 26 class WebContentDecryptionModuleSessionImpl; |
31 | 27 |
32 // 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. |
33 // Forwards the web session ID-based callbacks of the MediaKeys interface to the | 29 // Forwards the web session ID-based callbacks of the MediaKeys interface to the |
34 // appropriate session object. Callers should hold references to this class | 30 // appropriate session object. Callers should hold references to this class |
35 // as long as they need the CDM instance. | 31 // as long as they need the CDM instance. |
36 class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> { | 32 class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> { |
37 public: | 33 public: |
38 CdmSessionAdapter(); | 34 CdmSessionAdapter(); |
39 | 35 |
40 // Returns true on success. | 36 // Returns true on success. |
41 bool Initialize( | 37 bool Initialize(scoped_ptr<media::CdmFactory> cdm_factory, |
42 #if defined(ENABLE_PEPPER_CDMS) | 38 const std::string& key_system, |
43 const CreatePepperCdmCB& create_pepper_cdm_cb, | 39 const GURL& security_origin); |
44 #elif defined(ENABLE_BROWSER_CDMS) | |
45 RendererCdmManager* manager, | |
46 #endif | |
47 const std::string& key_system, | |
48 const GURL& security_origin); | |
49 | 40 |
50 // Provides a server certificate to be used to encrypt messages to the | 41 // Provides a server certificate to be used to encrypt messages to the |
51 // license server. | 42 // license server. |
52 void SetServerCertificate(const uint8* server_certificate, | 43 void SetServerCertificate(const uint8* server_certificate, |
53 int server_certificate_length, | 44 int server_certificate_length, |
54 scoped_ptr<media::SimpleCdmPromise> promise); | 45 scoped_ptr<media::SimpleCdmPromise> promise); |
55 | 46 |
56 // Creates a new session and adds it to the internal map. The caller owns the | 47 // Creates a new session and adds it to the internal map. The caller owns the |
57 // created session. RemoveSession() must be called when destroying it, if | 48 // created session. RemoveSession() must be called when destroying it, if |
58 // RegisterSession() was called. | 49 // RegisterSession() was called. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 145 |
155 // NOTE: Weak pointers must be invalidated before all other member variables. | 146 // NOTE: Weak pointers must be invalidated before all other member variables. |
156 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; | 147 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; |
157 | 148 |
158 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); | 149 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); |
159 }; | 150 }; |
160 | 151 |
161 } // namespace content | 152 } // namespace content |
162 | 153 |
163 #endif // CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ | 154 #endif // CONTENT_RENDERER_MEDIA_CDM_SESSION_ADAPTER_H_ |
OLD | NEW |