Index: content/renderer/media/webcontentdecryptionmodule_impl.cc |
diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.cc b/content/renderer/media/webcontentdecryptionmodule_impl.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0ed15eb746646d080016a91df8a868c29faa382d |
--- /dev/null |
+++ b/content/renderer/media/webcontentdecryptionmodule_impl.cc |
@@ -0,0 +1,97 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/renderer/media/webcontentdecryptionmodule_impl.h" |
+ |
+#include "base/logging.h" |
+#include "third_party/WebKit/public/platform/WebString.h" |
+#include "third_party/WebKit/public/platform/WebURL.h" |
+ |
+namespace content { |
+ |
+class WebContentDecryptionModuleSessionImpl |
+ : public WebKit::WebContentDecryptionModuleSession { |
+ public: |
+ WebContentDecryptionModuleSessionImpl( |
jamesr
2013/06/12 21:18:49
one-argument constructors need explicit
ddorwin
2013/06/12 21:37:22
Done.
|
+ WebKit::WebContentDecryptionModuleSession::Client* client); |
+ virtual ~WebContentDecryptionModuleSessionImpl(); |
+ |
+ // WebKit::WebContentDecryptionModuleSession implementation. |
+ virtual const WebKit::WebString& sessionId() const { return session_id_; } |
+ virtual void generateKeyRequest(const WebKit::WebString& mime_type, |
+ const unsigned char* init_data, |
jamesr
2013/06/12 21:18:49
assuming that you are using this type as a pointer
ddorwin
2013/06/12 21:37:22
This the implementation of a Blink platform API. W
|
+ unsigned init_data_length); |
jamesr
2013/06/12 21:18:49
if this is supposed to be the length of a buffer o
ddorwin
2013/06/12 21:37:22
As above, just following existing examples in Blin
|
+ virtual void update(const unsigned char* key, unsigned key_length); |
jamesr
2013/06/12 21:18:49
uint8*, size_t
ddorwin
2013/06/12 21:37:22
Same.
|
+ virtual void close(); |
+ |
+ private: |
+ WebKit::WebContentDecryptionModuleSession::Client* client_; |
+ WebKit::WebString session_id_; |
+ |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(WebContentDecryptionModuleSessionImpl); |
+}; |
+ |
+WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( |
+ WebKit::WebContentDecryptionModuleSession::Client* client) |
+ : client_(client) { |
+ // TODO(ddorwin): Populate session_id_ from the real implementation. |
+} |
+ |
+WebContentDecryptionModuleSessionImpl:: |
+~WebContentDecryptionModuleSessionImpl() { |
+} |
+ |
+void WebContentDecryptionModuleSessionImpl::generateKeyRequest( |
+ const WebKit::WebString& mime_type, |
+ const unsigned char* init_data, unsigned init_data_length) { |
+ // TODO(ddorwin): Call a real implementation and remove stub event triggers. |
+ NOTIMPLEMENTED(); |
+ client_->keyMessage(NULL, 0, WebKit::WebURL()); |
+} |
+ |
+void WebContentDecryptionModuleSessionImpl::update( |
+ const unsigned char* key, |
+ unsigned key_length) { |
+ DCHECK(key); |
+ |
+ // TODO(ddorwin): Call a real implementation and remove stub event triggers. |
+ NOTIMPLEMENTED(); |
+ // TODO(ddorwin): Remove when we have a real implementation that passes tests. |
+ if (key_length != 128 / 8) { |
jamesr
2013/06/12 21:18:49
surely this isn't the only place in the code that
ddorwin
2013/06/12 21:37:22
Done.
|
+ client_->keyError( |
+ WebKit::WebContentDecryptionModuleSession::Client:: |
+ MediaKeyErrorCodeUnknown, |
+ 0); |
+ return; |
+ } |
+ client_->keyAdded(); |
+} |
+ |
+void WebContentDecryptionModuleSessionImpl::close() { |
+ // TODO(ddorwin): Call a real implementation. |
+ NOTIMPLEMENTED(); |
+} |
+ |
+//------------------------------------------------------------------------------ |
+ |
+WebContentDecryptionModuleImpl* |
+WebContentDecryptionModuleImpl::create(const string16& key_system) { |
+ // TODO(ddorwin): Verify we can create the internal objects & load CDM first. |
+ return new WebContentDecryptionModuleImpl(key_system); |
+} |
+ |
+WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( |
+ const string16& key_system) { |
+} |
+ |
+WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { |
+} |
+ |
+WebKit::WebContentDecryptionModuleSession* |
+WebContentDecryptionModuleImpl::createSession( |
+ WebKit::WebContentDecryptionModuleSession::Client* client) { |
+ return new WebContentDecryptionModuleSessionImpl(client); |
+} |
+ |
+} // namespace content |