Chromium Code Reviews| 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_webcdm_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 RendererWebCDMSessionImpl : public WebKit::WebCDMSession { | |
| 14 public: | |
| 15 RendererWebCDMSessionImpl(WebKit::WebCDMSession::Client* client); | |
| 16 virtual ~RendererWebCDMSessionImpl(); | |
| 17 | |
| 18 // WebKit::WebCDMSession | |
|
scherkus (not reviewing)
2013/06/07 18:07:47
nit: ... implementation.
ddorwin
2013/06/10 22:53:01
Done.
| |
| 19 virtual const WebKit::WebString& sessionId() const { return session_id_; } | |
| 20 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.
| |
| 21 const unsigned char* initData, | |
| 22 unsigned initDataLength); | |
| 23 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.
| |
| 24 virtual void close(); | |
| 25 | |
| 26 private: | |
| 27 WebKit::WebCDMSession::Client* const client_; | |
| 28 WebKit::WebString session_id_; | |
| 29 | |
| 30 DISALLOW_IMPLICIT_CONSTRUCTORS(RendererWebCDMSessionImpl); | |
| 31 }; | |
| 32 | |
| 33 RendererWebCDMSessionImpl::RendererWebCDMSessionImpl( | |
| 34 WebKit::WebCDMSession::Client* client) | |
| 35 : 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.
| |
| 36 } | |
| 37 | |
| 38 RendererWebCDMSessionImpl::~RendererWebCDMSessionImpl() { | |
| 39 } | |
| 40 | |
| 41 void RendererWebCDMSessionImpl::generateKeyRequest( | |
| 42 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.
| |
| 43 const unsigned char* initData, unsigned initDataLength) { | |
| 44 | |
|
scherkus (not reviewing)
2013/06/07 18:07:47
remove line
ddorwin
2013/06/10 22:53:01
Done.
| |
| 45 // TODO(ddorwin): Call a real implementation and remove stub event triggers. | |
| 46 NOTIMPLEMENTED(); | |
| 47 client_->keyMessage(NULL, 0, WebKit::WebURL()); | |
| 48 | |
|
scherkus (not reviewing)
2013/06/07 18:07:47
remove line
ddorwin
2013/06/10 22:53:01
Done.
| |
| 49 } | |
| 50 | |
| 51 void RendererWebCDMSessionImpl::update(const unsigned char* key, | |
| 52 unsigned keyLength) { | |
|
scherkus (not reviewing)
2013/06/07 18:07:47
unix_hacker var names
ddorwin
2013/06/10 22:53:01
Done.
| |
| 53 DCHECK(key); | |
| 54 | |
| 55 // TODO(ddorwin): Call a real implementation and remove stub event triggers. | |
| 56 NOTIMPLEMENTED(); | |
| 57 // TODO(ddorwin): Remove when we have a real implementation that passes tests. | |
| 58 if (keyLength != 128 / 8) { | |
| 59 client_->keyError(WebKit::WebCDMSession::Client::MediaKeyErrorCodeUnknown, | |
| 60 0); | |
| 61 return; | |
| 62 } | |
| 63 client_->keyAdded(); | |
| 64 } | |
| 65 | |
| 66 void RendererWebCDMSessionImpl::close() { | |
| 67 // TODO(ddorwin): Call a real implementation. | |
| 68 NOTIMPLEMENTED(); | |
| 69 } | |
| 70 | |
| 71 //------------------------------------------------------------------------------ | |
| 72 | |
| 73 RendererWebCDMImpl* RendererWebCDMImpl::create(const string16& keySystem) { | |
| 74 // TODO(ddorwin): Verify we can create the internal objects & load CDM first. | |
| 75 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.
| |
| 76 } | |
| 77 | |
| 78 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.
| |
| 79 } | |
| 80 | |
| 81 RendererWebCDMImpl::~RendererWebCDMImpl() { | |
| 82 } | |
| 83 | |
| 84 WebKit::WebCDMSession* RendererWebCDMImpl::createSession( | |
| 85 WebKit::WebCDMSession::Client* client) { | |
| 86 return new RendererWebCDMSessionImpl(client); | |
| 87 } | |
| 88 | |
| 89 } // namespace content | |
| OLD | NEW |