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 // Return the Decryptor associated with this CDM. | |
xhwang
2013/12/30 19:50:49
nit: Return_s_
xhwang
2013/12/30 19:50:49
What if the current CDM doesn't have a decryptor,
jrummell
2014/01/08 19:12:31
Done.
jrummell
2014/01/08 19:12:31
Comment added.
| |
33 // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor | |
34 // after WebContentDecryptionModule is freed. http://crbug.com/330324 | |
35 media::Decryptor* GetDecryptor(); | |
36 | |
31 // blink::WebContentDecryptionModule implementation. | 37 // blink::WebContentDecryptionModule implementation. |
32 virtual blink::WebContentDecryptionModuleSession* createSession( | 38 virtual blink::WebContentDecryptionModuleSession* createSession( |
33 blink::WebContentDecryptionModuleSession::Client* client); | 39 blink::WebContentDecryptionModuleSession::Client* client); |
34 | 40 |
35 private: | 41 private: |
36 // Takes ownership of |media_keys| and |adapter|. | 42 // Takes ownership of |media_keys| and |adapter|. |
37 WebContentDecryptionModuleImpl(scoped_ptr<media::MediaKeys> media_keys, | 43 WebContentDecryptionModuleImpl(scoped_ptr<media::MediaKeys> media_keys, |
38 scoped_ptr<SessionIdAdapter> adapter); | 44 scoped_ptr<SessionIdAdapter> adapter); |
39 | 45 |
40 // Called when a WebContentDecryptionModuleSessionImpl is closed. | 46 // Called when a WebContentDecryptionModuleSessionImpl is closed. |
41 void OnSessionClosed(uint32 session_id); | 47 void OnSessionClosed(uint32 session_id); |
42 | 48 |
43 scoped_ptr<media::MediaKeys> media_keys_; | 49 scoped_ptr<media::MediaKeys> media_keys_; |
44 scoped_ptr<SessionIdAdapter> adapter_; | 50 scoped_ptr<SessionIdAdapter> adapter_; |
45 | 51 |
46 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); | 52 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); |
47 }; | 53 }; |
48 | 54 |
55 // Allow typecasting from blink type as this is the only implementation. | |
56 inline WebContentDecryptionModuleImpl* toWebContentDecryptionModuleImpl( | |
xhwang
2013/12/30 19:50:49
s/to/To?
jrummell
2014/01/08 19:12:31
Done.
| |
57 blink::WebContentDecryptionModule* cdm) { | |
58 return static_cast<WebContentDecryptionModuleImpl*>(cdm); | |
59 } | |
60 | |
49 } // namespace content | 61 } // namespace content |
50 | 62 |
51 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 63 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
OLD | NEW |