Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1031)

Side by Side Diff: content/renderer/media/webcontentdecryptionmodule_impl.h

Issue 660673002: Introduce CdmFactory interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_result_promise
Patch Set: comments addressed Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
9
10 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
13 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" 11 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"
ddorwin 2014/10/16 20:33:20 What about this? Replace with public/platform/WebC
xhwang 2014/10/17 00:11:49 I need this for blink::WebContentDecryptionModule.
14 12
15 namespace blink { 13 namespace blink {
16 #if defined(ENABLE_PEPPER_CDMS) 14 #if defined(ENABLE_PEPPER_CDMS)
17 class WebLocalFrame; 15 class WebLocalFrame;
18 #endif 16 #endif
19 class WebSecurityOrigin; 17 class WebSecurityOrigin;
20 } 18 }
21 19
22 namespace media { 20 namespace media {
21 class CdmFactory;
23 class Decryptor; 22 class Decryptor;
24 class MediaKeys; 23 class MediaKeys;
25 } 24 }
26 25
27 namespace content { 26 namespace content {
28 27
29 class CdmSessionAdapter; 28 class CdmSessionAdapter;
30 #if defined(ENABLE_BROWSER_CDMS)
31 class RendererCdmManager;
32 #endif
33 class WebContentDecryptionModuleSessionImpl; 29 class WebContentDecryptionModuleSessionImpl;
34 30
35 class WebContentDecryptionModuleImpl 31 class WebContentDecryptionModuleImpl
36 : public blink::WebContentDecryptionModule { 32 : public blink::WebContentDecryptionModule {
37 public: 33 public:
38 static WebContentDecryptionModuleImpl* Create( 34 static WebContentDecryptionModuleImpl* Create(
39 #if defined(ENABLE_PEPPER_CDMS) 35 const media::CdmFactory& cdm_factory,
40 blink::WebLocalFrame* frame,
41 #elif defined(ENABLE_BROWSER_CDMS)
42 RendererCdmManager* manager,
43 #endif
44 const blink::WebSecurityOrigin& security_origin, 36 const blink::WebSecurityOrigin& security_origin,
45 const base::string16& key_system); 37 const base::string16& key_system);
46 38
47 virtual ~WebContentDecryptionModuleImpl(); 39 virtual ~WebContentDecryptionModuleImpl();
48 40
49 // Returns the Decryptor associated with this CDM. May be NULL if no 41 // Returns the Decryptor associated with this CDM. May be NULL if no
50 // Decryptor associated with the MediaKeys object. 42 // Decryptor associated with the MediaKeys object.
51 // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor 43 // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor
52 // after WebContentDecryptionModule is freed. http://crbug.com/330324 44 // after WebContentDecryptionModule is freed. http://crbug.com/330324
53 media::Decryptor* GetDecryptor(); 45 media::Decryptor* GetDecryptor();
54 46
55 #if defined(ENABLE_BROWSER_CDMS) 47 #if defined(ENABLE_BROWSER_CDMS)
56 // Returns the CDM ID associated with this object. May be kInvalidCdmId if no 48 // Returns the CDM ID associated with this object. May be kInvalidCdmId if no
57 // CDM ID is associated, such as when Clear Key is used. 49 // CDM ID is associated, such as when Clear Key is used.
58 int GetCdmId() const; 50 int GetCdmId() const;
59 #endif // defined(ENABLE_BROWSER_CDMS) 51 #endif // defined(ENABLE_BROWSER_CDMS)
60 52
61 // blink::WebContentDecryptionModule implementation. 53 // blink::WebContentDecryptionModule implementation.
62 virtual blink::WebContentDecryptionModuleSession* createSession(); 54 virtual blink::WebContentDecryptionModuleSession* createSession();
63 // TODO(jrummell): Remove this method once blink updated. 55 // TODO(jrummell): Remove this method once blink updated.
64 virtual blink::WebContentDecryptionModuleSession* createSession( 56 virtual blink::WebContentDecryptionModuleSession* createSession(
65 blink::WebContentDecryptionModuleSession::Client* client); 57 blink::WebContentDecryptionModuleSession::Client* client);
66 58
67 virtual void setServerCertificate( 59 virtual void setServerCertificate(
68 const uint8* server_certificate, 60 const uint8* server_certificate,
69 size_t server_certificate_length, 61 size_t server_certificate_length,
70 blink::WebContentDecryptionModuleResult result); 62 blink::WebContentDecryptionModuleResult result);
ddorwin 2014/10/16 20:33:20 ICWYU
xhwang 2014/10/17 00:11:49 Done.
71 63
72 private: 64 private:
73 // Takes reference to |adapter|. 65 // Takes reference to |adapter|.
74 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter); 66 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter);
75 67
76 scoped_refptr<CdmSessionAdapter> adapter_; 68 scoped_refptr<CdmSessionAdapter> adapter_;
77 69
78 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); 70 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl);
79 }; 71 };
80 72
81 // Allow typecasting from blink type as this is the only implementation. 73 // Allow typecasting from blink type as this is the only implementation.
82 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( 74 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl(
83 blink::WebContentDecryptionModule* cdm) { 75 blink::WebContentDecryptionModule* cdm) {
84 return static_cast<WebContentDecryptionModuleImpl*>(cdm); 76 return static_cast<WebContentDecryptionModuleImpl*>(cdm);
85 } 77 }
86 78
87 } // namespace content 79 } // namespace content
88 80
89 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ 81 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698