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 MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ | 5 #ifndef MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ |
6 #define MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ | 6 #define MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "media/base/cdm_context.h" | 14 #include "media/base/cdm_context.h" |
15 #include "media/base/cdm_factory.h" | 15 #include "media/base/cdm_factory.h" |
16 #include "media/base/demuxer.h" | 16 #include "media/base/demuxer.h" |
17 #include "media/cdm/proxy_decryptor.h" | 17 #include "media/cdm/proxy_decryptor.h" |
18 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 18 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
19 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 19 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
20 | 20 |
21 namespace blink { | 21 namespace blink { |
22 class WebContentDecryptionModule; | 22 class WebContentDecryptionModule; |
23 class WebLocalFrame; | 23 class WebLocalFrame; |
24 class WebMediaPlayerClient; | 24 class WebMediaPlayerClient; |
25 class WebString; | 25 class WebString; |
26 } | 26 } |
27 | 27 |
28 namespace media { | 28 namespace media { |
29 | 29 |
| 30 class MediaPermission; |
30 class WebContentDecryptionModuleImpl; | 31 class WebContentDecryptionModuleImpl; |
31 | 32 |
32 // Provides support to prefixed EME implementation. | 33 // Provides support to prefixed EME implementation. |
33 // Do NOT add unprefixed EME functionality to this class! | 34 // Do NOT add unprefixed EME functionality to this class! |
34 // TODO(xhwang): When deprecating prefixed EME support, drop this whole file. | 35 // TODO(xhwang): When deprecating prefixed EME support, drop this whole file. |
35 class EncryptedMediaPlayerSupport | 36 class EncryptedMediaPlayerSupport |
36 : public base::SupportsWeakPtr<EncryptedMediaPlayerSupport> { | 37 : public base::SupportsWeakPtr<EncryptedMediaPlayerSupport> { |
37 public: | 38 public: |
38 typedef base::Callback<void(CdmContext*, const CdmAttachedCB&)> | 39 typedef base::Callback<void(CdmContext*, const CdmAttachedCB&)> |
39 SetCdmContextCB; | 40 SetCdmContextCB; |
40 | 41 |
41 EncryptedMediaPlayerSupport(scoped_ptr<CdmFactory> cdm_factory, | 42 EncryptedMediaPlayerSupport(scoped_ptr<CdmFactory> cdm_factory, |
42 blink::WebMediaPlayerClient* client, | 43 blink::WebMediaPlayerClient* client, |
| 44 MediaPermission* media_permission, |
43 const SetCdmContextCB& set_cdm_context_cb); | 45 const SetCdmContextCB& set_cdm_context_cb); |
44 ~EncryptedMediaPlayerSupport(); | 46 ~EncryptedMediaPlayerSupport(); |
45 | 47 |
46 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( | 48 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( |
47 blink::WebLocalFrame* frame, | 49 blink::WebLocalFrame* frame, |
48 const blink::WebString& key_system, | 50 const blink::WebString& key_system, |
49 const unsigned char* init_data, | 51 const unsigned char* init_data, |
50 unsigned init_data_length); | 52 unsigned init_data_length); |
51 | 53 |
52 blink::WebMediaPlayer::MediaKeyException AddKey( | 54 blink::WebMediaPlayer::MediaKeyException AddKey( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 MediaKeys::KeyError error_code, | 91 MediaKeys::KeyError error_code, |
90 uint32 system_code); | 92 uint32 system_code); |
91 void OnKeyMessage(const std::string& session_id, | 93 void OnKeyMessage(const std::string& session_id, |
92 const std::vector<uint8>& message, | 94 const std::vector<uint8>& message, |
93 const GURL& destination_url); | 95 const GURL& destination_url); |
94 | 96 |
95 scoped_ptr<CdmFactory> cdm_factory_; | 97 scoped_ptr<CdmFactory> cdm_factory_; |
96 | 98 |
97 blink::WebMediaPlayerClient* client_; | 99 blink::WebMediaPlayerClient* client_; |
98 | 100 |
| 101 MediaPermission* media_permission_; |
| 102 |
99 // The currently selected key system. Empty string means that no key system | 103 // The currently selected key system. Empty string means that no key system |
100 // has been selected. | 104 // has been selected. |
101 std::string current_key_system_; | 105 std::string current_key_system_; |
102 | 106 |
103 // We assume all streams are from the same container, thus have the same | 107 // We assume all streams are from the same container, thus have the same |
104 // init data type. | 108 // init data type. |
105 std::string init_data_type_; | 109 std::string init_data_type_; |
106 | 110 |
107 SetCdmContextCB set_cdm_context_cb_; | 111 SetCdmContextCB set_cdm_context_cb_; |
108 | 112 |
109 // Manages decryption keys and decrypts encrypted frames. | 113 // Manages decryption keys and decrypts encrypted frames. |
110 scoped_ptr<ProxyDecryptor> proxy_decryptor_; | 114 scoped_ptr<ProxyDecryptor> proxy_decryptor_; |
111 | 115 |
112 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport); | 116 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport); |
113 }; | 117 }; |
114 | 118 |
115 } // namespace media | 119 } // namespace media |
116 | 120 |
117 #endif // MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ | 121 #endif // MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ |
OLD | NEW |