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_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/renderer/media/crypto/encrypted_media_player_support.h" | 12 #include "content/renderer/media/crypto/encrypted_media_player_support.h" |
13 #include "content/renderer/media/crypto/proxy_decryptor.h" | 13 #include "content/renderer/media/crypto/proxy_decryptor.h" |
14 | 14 |
| 15 namespace blink { |
| 16 class WebMediaPlayerClient; |
| 17 } |
| 18 |
15 namespace content { | 19 namespace content { |
16 | 20 |
17 class WebContentDecryptionModuleImpl; | 21 class WebContentDecryptionModuleImpl; |
18 | 22 |
19 class EncryptedMediaPlayerSupportImpl | 23 class EncryptedMediaPlayerSupportImpl |
20 : public EncryptedMediaPlayerSupport, | 24 : public EncryptedMediaPlayerSupport, |
21 public base::SupportsWeakPtr<EncryptedMediaPlayerSupportImpl> { | 25 public base::SupportsWeakPtr<EncryptedMediaPlayerSupportImpl> { |
22 public: | 26 public: |
23 explicit EncryptedMediaPlayerSupportImpl(blink::WebMediaPlayerClient* client); | 27 static scoped_ptr<EncryptedMediaPlayerSupport> Create( |
| 28 blink::WebMediaPlayerClient* client); |
| 29 |
24 virtual ~EncryptedMediaPlayerSupportImpl(); | 30 virtual ~EncryptedMediaPlayerSupportImpl(); |
25 | 31 |
26 // EncryptedMediaPlayerSupport implementation. | 32 // EncryptedMediaPlayerSupport implementation. |
27 virtual blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( | 33 virtual blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( |
28 blink::WebLocalFrame* frame, | 34 blink::WebLocalFrame* frame, |
29 const blink::WebString& key_system, | 35 const blink::WebString& key_system, |
30 const unsigned char* init_data, | 36 const unsigned char* init_data, |
31 unsigned init_data_length) OVERRIDE; | 37 unsigned init_data_length) OVERRIDE; |
32 | 38 |
33 virtual blink::WebMediaPlayer::MediaKeyException AddKey( | 39 virtual blink::WebMediaPlayer::MediaKeyException AddKey( |
(...skipping 15 matching lines...) Expand all Loading... |
49 blink::WebContentDecryptionModuleResult result) OVERRIDE; | 55 blink::WebContentDecryptionModuleResult result) OVERRIDE; |
50 virtual void SetContentDecryptionModuleSync( | 56 virtual void SetContentDecryptionModuleSync( |
51 blink::WebContentDecryptionModule* cdm) OVERRIDE; | 57 blink::WebContentDecryptionModule* cdm) OVERRIDE; |
52 | 58 |
53 virtual media::SetDecryptorReadyCB CreateSetDecryptorReadyCB() OVERRIDE; | 59 virtual media::SetDecryptorReadyCB CreateSetDecryptorReadyCB() OVERRIDE; |
54 virtual media::Demuxer::NeedKeyCB CreateNeedKeyCB() OVERRIDE; | 60 virtual media::Demuxer::NeedKeyCB CreateNeedKeyCB() OVERRIDE; |
55 | 61 |
56 virtual void OnPipelineDecryptError() OVERRIDE; | 62 virtual void OnPipelineDecryptError() OVERRIDE; |
57 | 63 |
58 private: | 64 private: |
| 65 explicit EncryptedMediaPlayerSupportImpl(blink::WebMediaPlayerClient* client); |
| 66 |
59 // Requests that this object notifies when a decryptor is ready through the | 67 // Requests that this object notifies when a decryptor is ready through the |
60 // |decryptor_ready_cb| provided. | 68 // |decryptor_ready_cb| provided. |
61 // If |decryptor_ready_cb| is null, the existing callback will be fired with | 69 // If |decryptor_ready_cb| is null, the existing callback will be fired with |
62 // NULL immediately and reset. | 70 // NULL immediately and reset. |
63 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); | 71 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); |
64 | 72 |
65 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequestInternal( | 73 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequestInternal( |
66 blink::WebLocalFrame* frame, | 74 blink::WebLocalFrame* frame, |
67 const std::string& key_system, | 75 const std::string& key_system, |
68 const unsigned char* init_data, | 76 const unsigned char* init_data, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // setContentDecryptionModule(). | 120 // setContentDecryptionModule(). |
113 WebContentDecryptionModuleImpl* web_cdm_; | 121 WebContentDecryptionModuleImpl* web_cdm_; |
114 | 122 |
115 media::DecryptorReadyCB decryptor_ready_cb_; | 123 media::DecryptorReadyCB decryptor_ready_cb_; |
116 | 124 |
117 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupportImpl); | 125 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupportImpl); |
118 }; | 126 }; |
119 } | 127 } |
120 | 128 |
121 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_IMPL_H_ | 129 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_IMPL_H_ |
OLD | NEW |