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 |
71 scoped_refptr<CdmSessionAdapter> adapter_; | 78 scoped_refptr<CdmSessionAdapter> adapter_; |
72 | 79 |
| 80 // Keep track of all the outstanding WebContentDecryptionModuleResult objects. |
| 81 WebContentDecryptionModuleResultHelper outstanding_results_; |
| 82 |
| 83 // Since promises will live until they are fired, use a weak reference when |
| 84 // creating a promise in case this class disappears before the promise |
| 85 // actually fires. |
| 86 base::WeakPtrFactory<WebContentDecryptionModuleImpl> weak_ptr_factory_; |
| 87 |
73 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); | 88 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); |
74 }; | 89 }; |
75 | 90 |
76 // Allow typecasting from blink type as this is the only implementation. | 91 // Allow typecasting from blink type as this is the only implementation. |
77 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( | 92 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( |
78 blink::WebContentDecryptionModule* cdm) { | 93 blink::WebContentDecryptionModule* cdm) { |
79 return static_cast<WebContentDecryptionModuleImpl*>(cdm); | 94 return static_cast<WebContentDecryptionModuleImpl*>(cdm); |
80 } | 95 } |
81 | 96 |
82 } // namespace content | 97 } // namespace content |
83 | 98 |
84 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 99 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
OLD | NEW |