OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/renderer/media/renderer_webcontentdecryptionmodule_impl.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "third_party/WebKit/public/platform/WebString.h" | |
9 #include "third_party/WebKit/public/platform/WebURL.h" | |
10 | |
11 namespace content { | |
12 | |
13 class RendererWebContentDecryptionModuleSessionImpl | |
jamesr
2013/06/12 20:40:49
ditto on the redundant class names
| |
14 : public WebKit::WebContentDecryptionModuleSession { | |
15 public: | |
16 RendererWebContentDecryptionModuleSessionImpl( | |
17 WebKit::WebContentDecryptionModuleSession::Client* client); | |
18 virtual ~RendererWebContentDecryptionModuleSessionImpl(); | |
19 | |
20 // WebKit::WebContentDecryptionModuleSession implementation. | |
21 virtual const WebKit::WebString& sessionId() const { return session_id_; } | |
22 virtual void generateKeyRequest(const WebKit::WebString& mime_type, | |
23 const unsigned char* init_data, | |
24 unsigned init_data_length); | |
25 virtual void update(const unsigned char* key, unsigned key_length); | |
26 virtual void close(); | |
27 | |
28 private: | |
29 WebKit::WebContentDecryptionModuleSession::Client* const client_; | |
jamesr
2013/06/12 20:40:49
the constness here is a bit unusual. is there a ty
ddorwin
2013/06/12 21:13:00
Done.
| |
30 WebKit::WebString session_id_; | |
31 | |
32 DISALLOW_IMPLICIT_CONSTRUCTORS(RendererWebContentDecryptionModuleSessionImpl); | |
33 }; | |
34 | |
35 RendererWebContentDecryptionModuleSessionImpl:: | |
36 RendererWebContentDecryptionModuleSessionImpl( | |
37 WebKit::WebContentDecryptionModuleSession::Client* client) | |
38 : client_(client) { | |
39 // TODO(ddorwin): Populate session_id_ from the real implementation. | |
40 } | |
41 | |
42 RendererWebContentDecryptionModuleSessionImpl:: | |
43 ~RendererWebContentDecryptionModuleSessionImpl() { | |
44 } | |
45 | |
46 void RendererWebContentDecryptionModuleSessionImpl::generateKeyRequest( | |
47 const WebKit::WebString& mime_type, | |
48 const unsigned char* init_data, unsigned init_data_length) { | |
49 // TODO(ddorwin): Call a real implementation and remove stub event triggers. | |
50 NOTIMPLEMENTED(); | |
51 client_->keyMessage(NULL, 0, WebKit::WebURL()); | |
52 } | |
53 | |
54 void RendererWebContentDecryptionModuleSessionImpl::update( | |
55 const unsigned char* key, | |
56 unsigned key_length) { | |
57 DCHECK(key); | |
58 | |
59 // TODO(ddorwin): Call a real implementation and remove stub event triggers. | |
60 NOTIMPLEMENTED(); | |
61 // TODO(ddorwin): Remove when we have a real implementation that passes tests. | |
62 if (key_length != 128 / 8) { | |
jamesr
2013/06/12 20:40:49
128 / 8? how are these magical numbers derived?
ddorwin
2013/06/12 21:13:00
These are temporary magical numbers (per the TODO
| |
63 client_->keyError( | |
64 WebKit::WebContentDecryptionModuleSession::Client:: | |
65 MediaKeyErrorCodeUnknown, | |
66 0); | |
67 return; | |
68 } | |
69 client_->keyAdded(); | |
70 } | |
71 | |
72 void RendererWebContentDecryptionModuleSessionImpl::close() { | |
73 // TODO(ddorwin): Call a real implementation. | |
74 NOTIMPLEMENTED(); | |
75 } | |
76 | |
77 //------------------------------------------------------------------------------ | |
78 | |
79 RendererWebContentDecryptionModuleImpl* | |
80 RendererWebContentDecryptionModuleImpl::create(const string16& key_system) { | |
81 // TODO(ddorwin): Verify we can create the internal objects & load CDM first. | |
82 return new RendererWebContentDecryptionModuleImpl(key_system); | |
83 } | |
84 | |
85 RendererWebContentDecryptionModuleImpl::RendererWebContentDecryptionModuleImpl( | |
86 const string16& key_system) { | |
87 } | |
88 | |
89 RendererWebContentDecryptionModuleImpl::~RendererWebContentDecryptionModuleImpl( | |
90 ) { | |
jamesr
2013/06/12 20:40:49
very odd formatting
ddorwin
2013/06/12 21:13:00
Done. (It didn't fit before renaming and seemed mo
| |
91 } | |
92 | |
93 WebKit::WebContentDecryptionModuleSession* | |
94 RendererWebContentDecryptionModuleImpl::createSession( | |
95 WebKit::WebContentDecryptionModuleSession::Client* client) { | |
96 return new RendererWebContentDecryptionModuleSessionImpl(client); | |
97 } | |
98 | |
99 } // namespace content | |
OLD | NEW |