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_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_ |
6 #define MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_ | 6 #define MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" |
10 #include "media/base/cdm_factory.h" | 11 #include "media/base/cdm_factory.h" |
11 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleAccess.h" | 12 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleAccess.h" |
12 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h" | 13 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h" |
13 #include "third_party/WebKit/public/platform/WebString.h" | 14 #include "third_party/WebKit/public/platform/WebString.h" |
14 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 15 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 class WebLocalFrame; | 18 class WebLocalFrame; |
18 } | 19 } |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 | 22 |
| 23 class WebEncryptedMediaClientImpl; |
| 24 |
22 class WebContentDecryptionModuleAccessImpl | 25 class WebContentDecryptionModuleAccessImpl |
23 : public blink::WebContentDecryptionModuleAccess { | 26 : public blink::WebContentDecryptionModuleAccess { |
24 public: | 27 public: |
25 static WebContentDecryptionModuleAccessImpl* Create( | 28 static WebContentDecryptionModuleAccessImpl* Create( |
26 const blink::WebString& key_system, | 29 const blink::WebString& key_system, |
27 const blink::WebMediaKeySystemConfiguration& configuration, | 30 const blink::WebMediaKeySystemConfiguration& configuration, |
28 const blink::WebSecurityOrigin& security_origin, | 31 const blink::WebSecurityOrigin& security_origin, |
29 CdmFactory* cdm_factory); | 32 const base::WeakPtr<WebEncryptedMediaClientImpl>& client); |
30 virtual ~WebContentDecryptionModuleAccessImpl(); | 33 virtual ~WebContentDecryptionModuleAccessImpl(); |
31 | 34 |
32 // blink::WebContentDecryptionModuleAccess interface. | 35 // blink::WebContentDecryptionModuleAccess interface. |
33 virtual blink::WebMediaKeySystemConfiguration getConfiguration(); | 36 virtual blink::WebMediaKeySystemConfiguration getConfiguration(); |
34 virtual void createContentDecryptionModule( | 37 virtual void createContentDecryptionModule( |
35 blink::WebContentDecryptionModuleResult result); | 38 blink::WebContentDecryptionModuleResult result); |
36 | 39 |
37 private: | 40 private: |
38 WebContentDecryptionModuleAccessImpl( | 41 WebContentDecryptionModuleAccessImpl( |
39 const blink::WebString& key_system, | 42 const blink::WebString& key_system, |
40 const blink::WebMediaKeySystemConfiguration& configuration, | 43 const blink::WebMediaKeySystemConfiguration& configuration, |
41 const blink::WebSecurityOrigin& security_origin, | 44 const blink::WebSecurityOrigin& security_origin, |
42 CdmFactory* cdm_factory); | 45 const base::WeakPtr<WebEncryptedMediaClientImpl>& client); |
43 | 46 |
44 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleAccessImpl); | 47 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleAccessImpl); |
45 | 48 |
46 blink::WebString key_system_; | 49 blink::WebString key_system_; |
47 blink::WebMediaKeySystemConfiguration configuration_; | 50 blink::WebMediaKeySystemConfiguration configuration_; |
48 blink::WebSecurityOrigin security_origin_; | 51 blink::WebSecurityOrigin security_origin_; |
49 CdmFactory* cdm_factory_; | 52 |
| 53 // Keep a WeakPtr as client is owned by render_frame_impl. |
| 54 base::WeakPtr<WebEncryptedMediaClientImpl> client_; |
50 }; | 55 }; |
51 | 56 |
52 } // namespace media | 57 } // namespace media |
53 | 58 |
54 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_ | 59 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_ |
OLD | NEW |