| 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 MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
| 6 #define MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 6 #define MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "media/blink/media_blink_export.h" | 16 #include "media/blink/media_blink_export.h" |
| 17 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" | 17 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" |
| 18 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 18 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
| 19 | 19 |
| 20 namespace blink { | 20 namespace blink { |
| 21 class WebSecurityOrigin; | 21 class WebSecurityOrigin; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace media { | 24 namespace media { |
| 25 | 25 |
| 26 struct CdmConfig; | 26 struct CdmConfig; |
| 27 class CdmFactory; | 27 class CdmFactory; |
| 28 class CdmSessionAdapter; | 28 class CdmSessionAdapter; |
| 29 class MediaKeys; | 29 class ContentDecryptionModule; |
| 30 | 30 |
| 31 class MEDIA_BLINK_EXPORT WebContentDecryptionModuleImpl | 31 class MEDIA_BLINK_EXPORT WebContentDecryptionModuleImpl |
| 32 : public blink::WebContentDecryptionModule { | 32 : public blink::WebContentDecryptionModule { |
| 33 public: | 33 public: |
| 34 static void Create( | 34 static void Create( |
| 35 CdmFactory* cdm_factory, | 35 CdmFactory* cdm_factory, |
| 36 const base::string16& key_system, | 36 const base::string16& key_system, |
| 37 const blink::WebSecurityOrigin& security_origin, | 37 const blink::WebSecurityOrigin& security_origin, |
| 38 const CdmConfig& cdm_config, | 38 const CdmConfig& cdm_config, |
| 39 std::unique_ptr<blink::WebContentDecryptionModuleResult> result); | 39 std::unique_ptr<blink::WebContentDecryptionModuleResult> result); |
| 40 | 40 |
| 41 ~WebContentDecryptionModuleImpl() override; | 41 ~WebContentDecryptionModuleImpl() override; |
| 42 | 42 |
| 43 // blink::WebContentDecryptionModule implementation. | 43 // blink::WebContentDecryptionModule implementation. |
| 44 blink::WebContentDecryptionModuleSession* createSession() override; | 44 blink::WebContentDecryptionModuleSession* createSession() override; |
| 45 | 45 |
| 46 void setServerCertificate( | 46 void setServerCertificate( |
| 47 const uint8_t* server_certificate, | 47 const uint8_t* server_certificate, |
| 48 size_t server_certificate_length, | 48 size_t server_certificate_length, |
| 49 blink::WebContentDecryptionModuleResult result) override; | 49 blink::WebContentDecryptionModuleResult result) override; |
| 50 | 50 |
| 51 // Returns a reference to the CDM used by |adapter_|. | 51 // Returns a reference to the CDM used by |adapter_|. |
| 52 scoped_refptr<MediaKeys> GetCdm(); | 52 scoped_refptr<ContentDecryptionModule> GetCdm(); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 friend CdmSessionAdapter; | 55 friend CdmSessionAdapter; |
| 56 | 56 |
| 57 // Takes reference to |adapter|. | 57 // Takes reference to |adapter|. |
| 58 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter); | 58 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter); |
| 59 | 59 |
| 60 scoped_refptr<CdmSessionAdapter> adapter_; | 60 scoped_refptr<CdmSessionAdapter> adapter_; |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); | 62 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // Allow typecasting from blink type as this is the only implementation. | 65 // Allow typecasting from blink type as this is the only implementation. |
| 66 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( | 66 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( |
| 67 blink::WebContentDecryptionModule* cdm) { | 67 blink::WebContentDecryptionModule* cdm) { |
| 68 return static_cast<WebContentDecryptionModuleImpl*>(cdm); | 68 return static_cast<WebContentDecryptionModuleImpl*>(cdm); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace media | 71 } // namespace media |
| 72 | 72 |
| 73 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 73 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
| OLD | NEW |