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/proxy_decryptor.h" | 12 #include "content/renderer/media/crypto/proxy_decryptor.h" |
13 #include "media/blink/encrypted_media_player_support.h" | 13 #include "media/blink/encrypted_media_player_support.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 class WebMediaPlayerClient; | 16 class WebMediaPlayerClient; |
17 } | 17 } |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 class WebContentDecryptionModuleImpl; | 21 class WebContentDecryptionModuleImpl; |
22 | 22 |
23 class EncryptedMediaPlayerSupportImpl | 23 class EncryptedMediaPlayerSupportImpl |
24 : public media::EncryptedMediaPlayerSupport, | 24 : public media::EncryptedMediaPlayerSupport, |
25 public base::SupportsWeakPtr<EncryptedMediaPlayerSupportImpl> { | 25 public base::SupportsWeakPtr<EncryptedMediaPlayerSupportImpl> { |
26 public: | 26 public: |
27 static scoped_ptr<EncryptedMediaPlayerSupport> Create( | 27 static scoped_ptr<EncryptedMediaPlayerSupport> Create( |
28 blink::WebMediaPlayerClient* client); | 28 blink::WebMediaPlayerClient* client); |
29 | 29 |
30 virtual ~EncryptedMediaPlayerSupportImpl(); | 30 ~EncryptedMediaPlayerSupportImpl() override; |
31 | 31 |
32 // EncryptedMediaPlayerSupport implementation. | 32 // EncryptedMediaPlayerSupport implementation. |
33 virtual blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( | 33 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( |
34 blink::WebLocalFrame* frame, | 34 blink::WebLocalFrame* frame, |
35 const blink::WebString& key_system, | 35 const blink::WebString& key_system, |
36 const unsigned char* init_data, | 36 const unsigned char* init_data, |
37 unsigned init_data_length) override; | 37 unsigned init_data_length) override; |
38 | 38 |
39 virtual blink::WebMediaPlayer::MediaKeyException AddKey( | 39 blink::WebMediaPlayer::MediaKeyException AddKey( |
40 const blink::WebString& key_system, | 40 const blink::WebString& key_system, |
41 const unsigned char* key, | 41 const unsigned char* key, |
42 unsigned key_length, | 42 unsigned key_length, |
43 const unsigned char* init_data, | 43 const unsigned char* init_data, |
44 unsigned init_data_length, | 44 unsigned init_data_length, |
45 const blink::WebString& session_id) override; | 45 const blink::WebString& session_id) override; |
46 | 46 |
47 virtual blink::WebMediaPlayer::MediaKeyException CancelKeyRequest( | 47 blink::WebMediaPlayer::MediaKeyException CancelKeyRequest( |
48 const blink::WebString& key_system, | 48 const blink::WebString& key_system, |
49 const blink::WebString& session_id) override; | 49 const blink::WebString& session_id) override; |
50 | 50 |
51 virtual void SetInitialContentDecryptionModule( | 51 void SetInitialContentDecryptionModule( |
52 blink::WebContentDecryptionModule* initial_cdm) override; | 52 blink::WebContentDecryptionModule* initial_cdm) override; |
53 | 53 |
54 virtual void SetContentDecryptionModule( | 54 void SetContentDecryptionModule( |
55 blink::WebContentDecryptionModule* cdm) override; | 55 blink::WebContentDecryptionModule* cdm) override; |
56 virtual void SetContentDecryptionModule( | 56 void SetContentDecryptionModule( |
57 blink::WebContentDecryptionModule* cdm, | 57 blink::WebContentDecryptionModule* cdm, |
58 blink::WebContentDecryptionModuleResult result) override; | 58 blink::WebContentDecryptionModuleResult result) override; |
59 | 59 |
60 virtual media::SetDecryptorReadyCB CreateSetDecryptorReadyCB() override; | 60 media::SetDecryptorReadyCB CreateSetDecryptorReadyCB() override; |
61 virtual media::Demuxer::NeedKeyCB CreateNeedKeyCB() override; | 61 media::Demuxer::NeedKeyCB CreateNeedKeyCB() override; |
62 | 62 |
63 virtual void OnPipelineDecryptError() override; | 63 void OnPipelineDecryptError() override; |
64 | 64 |
65 private: | 65 private: |
66 explicit EncryptedMediaPlayerSupportImpl(blink::WebMediaPlayerClient* client); | 66 explicit EncryptedMediaPlayerSupportImpl(blink::WebMediaPlayerClient* client); |
67 | 67 |
68 // Requests that this object notifies when a decryptor is ready through the | 68 // Requests that this object notifies when a decryptor is ready through the |
69 // |decryptor_ready_cb| provided. | 69 // |decryptor_ready_cb| provided. |
70 // If |decryptor_ready_cb| is null, the existing callback will be fired with | 70 // If |decryptor_ready_cb| is null, the existing callback will be fired with |
71 // NULL immediately and reset. | 71 // NULL immediately and reset. |
72 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); | 72 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); |
73 | 73 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // setContentDecryptionModule(). | 121 // setContentDecryptionModule(). |
122 WebContentDecryptionModuleImpl* web_cdm_; | 122 WebContentDecryptionModuleImpl* web_cdm_; |
123 | 123 |
124 media::DecryptorReadyCB decryptor_ready_cb_; | 124 media::DecryptorReadyCB decryptor_ready_cb_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupportImpl); | 126 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupportImpl); |
127 }; | 127 }; |
128 } | 128 } |
129 | 129 |
130 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_IMPL_H_ | 130 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_IMPL_H_ |
OLD | NEW |