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