Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: content/renderer/media/webcontentdecryptionmodule_impl.cc

Issue 16583004: Add Stubbed implementation of WebCDM* interfaces for unprefixed EME APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Dropped "Renderer" Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/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 WebContentDecryptionModuleSessionImpl
14 : public WebKit::WebContentDecryptionModuleSession {
15 public:
16 WebContentDecryptionModuleSessionImpl(
jamesr 2013/06/12 21:18:49 one-argument constructors need explicit
ddorwin 2013/06/12 21:37:22 Done.
17 WebKit::WebContentDecryptionModuleSession::Client* client);
18 virtual ~WebContentDecryptionModuleSessionImpl();
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,
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
24 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
25 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.
26 virtual void close();
27
28 private:
29 WebKit::WebContentDecryptionModuleSession::Client* client_;
30 WebKit::WebString session_id_;
31
32 DISALLOW_IMPLICIT_CONSTRUCTORS(WebContentDecryptionModuleSessionImpl);
33 };
34
35 WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl(
36 WebKit::WebContentDecryptionModuleSession::Client* client)
37 : client_(client) {
38 // TODO(ddorwin): Populate session_id_ from the real implementation.
39 }
40
41 WebContentDecryptionModuleSessionImpl::
42 ~WebContentDecryptionModuleSessionImpl() {
43 }
44
45 void WebContentDecryptionModuleSessionImpl::generateKeyRequest(
46 const WebKit::WebString& mime_type,
47 const unsigned char* init_data, unsigned init_data_length) {
48 // TODO(ddorwin): Call a real implementation and remove stub event triggers.
49 NOTIMPLEMENTED();
50 client_->keyMessage(NULL, 0, WebKit::WebURL());
51 }
52
53 void WebContentDecryptionModuleSessionImpl::update(
54 const unsigned char* key,
55 unsigned key_length) {
56 DCHECK(key);
57
58 // TODO(ddorwin): Call a real implementation and remove stub event triggers.
59 NOTIMPLEMENTED();
60 // TODO(ddorwin): Remove when we have a real implementation that passes tests.
61 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.
62 client_->keyError(
63 WebKit::WebContentDecryptionModuleSession::Client::
64 MediaKeyErrorCodeUnknown,
65 0);
66 return;
67 }
68 client_->keyAdded();
69 }
70
71 void WebContentDecryptionModuleSessionImpl::close() {
72 // TODO(ddorwin): Call a real implementation.
73 NOTIMPLEMENTED();
74 }
75
76 //------------------------------------------------------------------------------
77
78 WebContentDecryptionModuleImpl*
79 WebContentDecryptionModuleImpl::create(const string16& key_system) {
80 // TODO(ddorwin): Verify we can create the internal objects & load CDM first.
81 return new WebContentDecryptionModuleImpl(key_system);
82 }
83
84 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl(
85 const string16& key_system) {
86 }
87
88 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() {
89 }
90
91 WebKit::WebContentDecryptionModuleSession*
92 WebContentDecryptionModuleImpl::createSession(
93 WebKit::WebContentDecryptionModuleSession::Client* client) {
94 return new WebContentDecryptionModuleSessionImpl(client);
95 }
96
97 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698