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" |
13 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" | 14 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 #if defined(ENABLE_PEPPER_CDMS) | 17 #if defined(ENABLE_PEPPER_CDMS) |
17 class WebLocalFrame; | 18 class WebLocalFrame; |
18 #endif | 19 #endif |
19 class WebSecurityOrigin; | 20 class WebSecurityOrigin; |
20 } | 21 } |
21 | 22 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // CDM ID is associated, such as when Clear Key is used. | 58 // CDM ID is associated, such as when Clear Key is used. |
58 int GetCdmId() const; | 59 int GetCdmId() const; |
59 #endif // defined(ENABLE_BROWSER_CDMS) | 60 #endif // defined(ENABLE_BROWSER_CDMS) |
60 | 61 |
61 // blink::WebContentDecryptionModule implementation. | 62 // blink::WebContentDecryptionModule implementation. |
62 virtual blink::WebContentDecryptionModuleSession* createSession(); | 63 virtual blink::WebContentDecryptionModuleSession* createSession(); |
63 // TODO(jrummell): Remove this method once blink updated. | 64 // TODO(jrummell): Remove this method once blink updated. |
64 virtual blink::WebContentDecryptionModuleSession* createSession( | 65 virtual blink::WebContentDecryptionModuleSession* createSession( |
65 blink::WebContentDecryptionModuleSession::Client* client); | 66 blink::WebContentDecryptionModuleSession::Client* client); |
66 | 67 |
| 68 virtual void setServerCertificate( |
| 69 const uint8* server_certificate, |
| 70 size_t server_certificate_length, |
| 71 blink::WebContentDecryptionModuleResult result); |
| 72 |
67 private: | 73 private: |
68 // Takes reference to |adapter|. | 74 // Takes reference to |adapter|. |
69 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter); | 75 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter); |
70 | 76 |
71 scoped_refptr<CdmSessionAdapter> adapter_; | 77 scoped_refptr<CdmSessionAdapter> adapter_; |
72 | 78 |
| 79 // Since promises will live until they are fired, use a weak reference when |
| 80 // creating a promise in case this class disappears before the promise |
| 81 // actually fires. |
| 82 base::WeakPtrFactory<WebContentDecryptionModuleImpl> weak_ptr_factory_; |
| 83 |
73 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); | 84 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); |
74 }; | 85 }; |
75 | 86 |
76 // Allow typecasting from blink type as this is the only implementation. | 87 // Allow typecasting from blink type as this is the only implementation. |
77 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( | 88 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( |
78 blink::WebContentDecryptionModule* cdm) { | 89 blink::WebContentDecryptionModule* cdm) { |
79 return static_cast<WebContentDecryptionModuleImpl*>(cdm); | 90 return static_cast<WebContentDecryptionModuleImpl*>(cdm); |
80 } | 91 } |
81 | 92 |
82 } // namespace content | 93 } // namespace content |
83 | 94 |
84 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ | 95 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ |
OLD | NEW |