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 CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | |
12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "content/renderer/media/webcontentdecryptionmoduleresult_helper.h" | |
13 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" | 15 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" |
14 | 16 |
15 namespace blink { | 17 namespace blink { |
16 #if defined(ENABLE_PEPPER_CDMS) | 18 #if defined(ENABLE_PEPPER_CDMS) |
17 class WebLocalFrame; | 19 class WebLocalFrame; |
18 #endif | 20 #endif |
19 class WebSecurityOrigin; | 21 class WebSecurityOrigin; |
20 } | 22 } |
21 | 23 |
22 namespace media { | 24 namespace media { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 // CDM ID is associated, such as when Clear Key is used. | 59 // CDM ID is associated, such as when Clear Key is used. |
58 int GetCdmId() const; | 60 int GetCdmId() const; |
59 #endif // defined(ENABLE_BROWSER_CDMS) | 61 #endif // defined(ENABLE_BROWSER_CDMS) |
60 | 62 |
61 // blink::WebContentDecryptionModule implementation. | 63 // blink::WebContentDecryptionModule implementation. |
62 virtual blink::WebContentDecryptionModuleSession* createSession(); | 64 virtual blink::WebContentDecryptionModuleSession* createSession(); |
63 // TODO(jrummell): Remove this method once blink updated. | 65 // TODO(jrummell): Remove this method once blink updated. |
64 virtual blink::WebContentDecryptionModuleSession* createSession( | 66 virtual blink::WebContentDecryptionModuleSession* createSession( |
65 blink::WebContentDecryptionModuleSession::Client* client); | 67 blink::WebContentDecryptionModuleSession::Client* client); |
66 | 68 |
69 virtual void setServerCertificate( | |
70 const uint8* server_certificate, | |
71 size_t server_certificate_length, | |
72 blink::WebContentDecryptionModuleResult result); | |
73 | |
67 private: | 74 private: |
68 // Takes reference to |adapter|. | 75 // Takes reference to |adapter|. |
69 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter); | 76 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter); |
70 | 77 |
78 // Used when setServerCertificate() promise is resolved/rejected. | |
ddorwin
2014/09/10 22:58:38
Why isn't this handled as a "Result"?
jrummell
2014/09/11 21:21:55
On the Chromium side we switch to CdmPromise, so t
| |
79 void CertificateSet(uint32 result_index); | |
ddorwin
2014/09/10 22:58:38
On...?
ditto below
jrummell
2014/09/11 21:21:55
Done.
| |
80 void SessionError(uint32 result_index, | |
ddorwin
2014/09/10 22:58:39
Why does the CDM object handle a session error?
jrummell
2014/09/11 21:21:55
This is the promise rejected. Renamed.
| |
81 media::MediaKeys::Exception exception_code, | |
82 uint32 system_code, | |
83 const std::string& error_message); | |
84 | |
71 scoped_refptr<CdmSessionAdapter> adapter_; | 85 scoped_refptr<CdmSessionAdapter> adapter_; |
72 | 86 |
87 // Keep track of all the outstanding WebContentDecryptionModuleResult objects. | |
88 WebContentDecryptionModuleResultHelper outstanding_results_; | |
89 | |
90 // Since promises will live until they are fired, use a weak reference when | |
91 // creating a promise in case this class disappears before the promise | |
92 // actually fires. | |
93 base::WeakPtrFactory<WebContentDecryptionModuleImpl> weak_ptr_factory_; | |
94 | |
73 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); | 95 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); |
74 }; | 96 }; |
75 | 97 |
76 // Allow typecasting from blink type as this is the only implementation. | 98 // Allow typecasting from blink type as this is the only implementation. |
77 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( | 99 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( |
78 blink::WebContentDecryptionModule* cdm) { | 100 blink::WebContentDecryptionModule* cdm) { |
79 return static_cast<WebContentDecryptionModuleImpl*>(cdm); | 101 return static_cast<WebContentDecryptionModuleImpl*>(cdm); |
80 } | 102 } |
81 | 103 |
82 } // namespace content | 104 } // namespace content |
83 | 105 |
84 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 106 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
OLD | NEW |