OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" | 12 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
| 15 class Decryptor; |
15 class MediaKeys; | 16 class MediaKeys; |
16 } | 17 } |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class WebContentDecryptionModuleSessionImpl; | 21 class WebContentDecryptionModuleSessionImpl; |
21 class SessionIdAdapter; | 22 class SessionIdAdapter; |
22 | 23 |
23 class WebContentDecryptionModuleImpl | 24 class WebContentDecryptionModuleImpl |
24 : public blink::WebContentDecryptionModule { | 25 : public blink::WebContentDecryptionModule { |
25 public: | 26 public: |
26 static WebContentDecryptionModuleImpl* Create( | 27 static WebContentDecryptionModuleImpl* Create( |
27 const base::string16& key_system); | 28 const base::string16& key_system); |
28 | 29 |
29 virtual ~WebContentDecryptionModuleImpl(); | 30 virtual ~WebContentDecryptionModuleImpl(); |
30 | 31 |
| 32 // Returns the Decryptor associated with this CDM. May be NULL if no |
| 33 // Decryptor associated with the MediaKeys object. |
| 34 // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor |
| 35 // after WebContentDecryptionModule is freed. http://crbug.com/330324 |
| 36 media::Decryptor* GetDecryptor(); |
| 37 |
31 // blink::WebContentDecryptionModule implementation. | 38 // blink::WebContentDecryptionModule implementation. |
32 virtual blink::WebContentDecryptionModuleSession* createSession( | 39 virtual blink::WebContentDecryptionModuleSession* createSession( |
33 blink::WebContentDecryptionModuleSession::Client* client); | 40 blink::WebContentDecryptionModuleSession::Client* client); |
34 | 41 |
35 private: | 42 private: |
36 // Takes ownership of |media_keys| and |adapter|. | 43 // Takes ownership of |media_keys| and |adapter|. |
37 WebContentDecryptionModuleImpl(scoped_ptr<media::MediaKeys> media_keys, | 44 WebContentDecryptionModuleImpl(scoped_ptr<media::MediaKeys> media_keys, |
38 scoped_ptr<SessionIdAdapter> adapter); | 45 scoped_ptr<SessionIdAdapter> adapter); |
39 | 46 |
40 // Called when a WebContentDecryptionModuleSessionImpl is closed. | 47 // Called when a WebContentDecryptionModuleSessionImpl is closed. |
41 void OnSessionClosed(uint32 session_id); | 48 void OnSessionClosed(uint32 session_id); |
42 | 49 |
43 scoped_ptr<media::MediaKeys> media_keys_; | 50 scoped_ptr<media::MediaKeys> media_keys_; |
44 scoped_ptr<SessionIdAdapter> adapter_; | 51 scoped_ptr<SessionIdAdapter> adapter_; |
45 | 52 |
46 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); | 53 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); |
47 }; | 54 }; |
48 | 55 |
| 56 // Allow typecasting from blink type as this is the only implementation. |
| 57 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( |
| 58 blink::WebContentDecryptionModule* cdm) { |
| 59 return static_cast<WebContentDecryptionModuleImpl*>(cdm); |
| 60 } |
| 61 |
49 } // namespace content | 62 } // namespace content |
50 | 63 |
51 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 64 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
OLD | NEW |