Chromium Code Reviews| Index: content/renderer/media/renderer_webcontentdecryptionmodule_impl.cc |
| diff --git a/content/renderer/media/renderer_webcontentdecryptionmodule_impl.cc b/content/renderer/media/renderer_webcontentdecryptionmodule_impl.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..96299ebe417c2f3374f5c2f39ee76e98843b9fee |
| --- /dev/null |
| +++ b/content/renderer/media/renderer_webcontentdecryptionmodule_impl.cc |
| @@ -0,0 +1,99 @@ |
| +// 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/renderer_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 RendererWebContentDecryptionModuleSessionImpl |
|
jamesr
2013/06/12 20:40:49
ditto on the redundant class names
|
| + : public WebKit::WebContentDecryptionModuleSession { |
| + public: |
| + RendererWebContentDecryptionModuleSessionImpl( |
| + WebKit::WebContentDecryptionModuleSession::Client* client); |
| + virtual ~RendererWebContentDecryptionModuleSessionImpl(); |
| + |
| + // 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, |
| + unsigned init_data_length); |
| + virtual void update(const unsigned char* key, unsigned key_length); |
| + virtual void close(); |
| + |
| + private: |
| + 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.
|
| + WebKit::WebString session_id_; |
| + |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(RendererWebContentDecryptionModuleSessionImpl); |
| +}; |
| + |
| +RendererWebContentDecryptionModuleSessionImpl:: |
| +RendererWebContentDecryptionModuleSessionImpl( |
| + WebKit::WebContentDecryptionModuleSession::Client* client) |
| + : client_(client) { |
| + // TODO(ddorwin): Populate session_id_ from the real implementation. |
| +} |
| + |
| +RendererWebContentDecryptionModuleSessionImpl:: |
| +~RendererWebContentDecryptionModuleSessionImpl() { |
| +} |
| + |
| +void RendererWebContentDecryptionModuleSessionImpl::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 RendererWebContentDecryptionModuleSessionImpl::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 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
|
| + client_->keyError( |
| + WebKit::WebContentDecryptionModuleSession::Client:: |
| + MediaKeyErrorCodeUnknown, |
| + 0); |
| + return; |
| + } |
| + client_->keyAdded(); |
| +} |
| + |
| +void RendererWebContentDecryptionModuleSessionImpl::close() { |
| + // TODO(ddorwin): Call a real implementation. |
| + NOTIMPLEMENTED(); |
| +} |
| + |
| +//------------------------------------------------------------------------------ |
| + |
| +RendererWebContentDecryptionModuleImpl* |
| +RendererWebContentDecryptionModuleImpl::create(const string16& key_system) { |
| + // TODO(ddorwin): Verify we can create the internal objects & load CDM first. |
| + return new RendererWebContentDecryptionModuleImpl(key_system); |
| +} |
| + |
| +RendererWebContentDecryptionModuleImpl::RendererWebContentDecryptionModuleImpl( |
| + const string16& key_system) { |
| +} |
| + |
| +RendererWebContentDecryptionModuleImpl::~RendererWebContentDecryptionModuleImpl( |
| + ) { |
|
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
|
| +} |
| + |
| +WebKit::WebContentDecryptionModuleSession* |
| +RendererWebContentDecryptionModuleImpl::createSession( |
| + WebKit::WebContentDecryptionModuleSession::Client* client) { |
| + return new RendererWebContentDecryptionModuleSessionImpl(client); |
| +} |
| + |
| +} // namespace content |