Chromium Code Reviews| Index: content/renderer/media/renderer_webcdm_impl.cc |
| diff --git a/content/renderer/media/renderer_webcdm_impl.cc b/content/renderer/media/renderer_webcdm_impl.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..096155d500f8b83082ca96e2b06fb1c11619514a |
| --- /dev/null |
| +++ b/content/renderer/media/renderer_webcdm_impl.cc |
| @@ -0,0 +1,89 @@ |
| +// 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_webcdm_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 RendererWebCDMSessionImpl : public WebKit::WebCDMSession { |
| + public: |
| + RendererWebCDMSessionImpl(WebKit::WebCDMSession::Client* client); |
| + virtual ~RendererWebCDMSessionImpl(); |
| + |
| + // WebKit::WebCDMSession |
|
scherkus (not reviewing)
2013/06/07 18:07:47
nit: ... implementation.
ddorwin
2013/06/10 22:53:01
Done.
|
| + virtual const WebKit::WebString& sessionId() const { return session_id_; } |
| + virtual void generateKeyRequest(const WebKit::WebString& mimeType, |
|
scherkus (not reviewing)
2013/06/07 18:07:47
unix_hacker var names
ddorwin
2013/06/10 22:53:01
Done.
|
| + const unsigned char* initData, |
| + unsigned initDataLength); |
| + virtual void update(const unsigned char* key, unsigned keyLength); |
|
scherkus (not reviewing)
2013/06/07 18:07:47
unix_hacker var names
ddorwin
2013/06/10 22:53:01
Done.
|
| + virtual void close(); |
| + |
| + private: |
| + WebKit::WebCDMSession::Client* const client_; |
| + WebKit::WebString session_id_; |
| + |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(RendererWebCDMSessionImpl); |
| +}; |
| + |
| +RendererWebCDMSessionImpl::RendererWebCDMSessionImpl( |
| + WebKit::WebCDMSession::Client* client) |
| + : client_(client) { |
|
scherkus (not reviewing)
2013/06/07 18:07:47
does session_id_ need to be init'd to anything in
ddorwin
2013/06/10 22:53:01
It will. I added a TODO to make this obvious.
|
| +} |
| + |
| +RendererWebCDMSessionImpl::~RendererWebCDMSessionImpl() { |
| +} |
| + |
| +void RendererWebCDMSessionImpl::generateKeyRequest( |
| + const WebKit::WebString& mimeType, |
|
scherkus (not reviewing)
2013/06/07 18:07:47
unix_hacker var names
ddorwin
2013/06/10 22:53:01
Done.
|
| + const unsigned char* initData, unsigned initDataLength) { |
| + |
|
scherkus (not reviewing)
2013/06/07 18:07:47
remove line
ddorwin
2013/06/10 22:53:01
Done.
|
| + // TODO(ddorwin): Call a real implementation and remove stub event triggers. |
| + NOTIMPLEMENTED(); |
| + client_->keyMessage(NULL, 0, WebKit::WebURL()); |
| + |
|
scherkus (not reviewing)
2013/06/07 18:07:47
remove line
ddorwin
2013/06/10 22:53:01
Done.
|
| +} |
| + |
| +void RendererWebCDMSessionImpl::update(const unsigned char* key, |
| + unsigned keyLength) { |
|
scherkus (not reviewing)
2013/06/07 18:07:47
unix_hacker var names
ddorwin
2013/06/10 22:53:01
Done.
|
| + 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 (keyLength != 128 / 8) { |
| + client_->keyError(WebKit::WebCDMSession::Client::MediaKeyErrorCodeUnknown, |
| + 0); |
| + return; |
| + } |
| + client_->keyAdded(); |
| +} |
| + |
| +void RendererWebCDMSessionImpl::close() { |
| + // TODO(ddorwin): Call a real implementation. |
| + NOTIMPLEMENTED(); |
| +} |
| + |
| +//------------------------------------------------------------------------------ |
| + |
| +RendererWebCDMImpl* RendererWebCDMImpl::create(const string16& keySystem) { |
| + // TODO(ddorwin): Verify we can create the internal objects & load CDM first. |
| + return new RendererWebCDMImpl(keySystem); |
|
scherkus (not reviewing)
2013/06/07 18:07:47
unix_hacker var names
ddorwin
2013/06/10 22:53:01
Done.
|
| +} |
| + |
| +RendererWebCDMImpl::RendererWebCDMImpl(const string16& keySystem) { |
|
scherkus (not reviewing)
2013/06/07 18:07:47
unix_hacker var names
ddorwin
2013/06/10 22:53:01
Done.
|
| +} |
| + |
| +RendererWebCDMImpl::~RendererWebCDMImpl() { |
| +} |
| + |
| +WebKit::WebCDMSession* RendererWebCDMImpl::createSession( |
| + WebKit::WebCDMSession::Client* client) { |
| + return new RendererWebCDMSessionImpl(client); |
| +} |
| + |
| +} // namespace content |