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/webcontentdecryptionmodule_impl.h" | |
6 | |
7 #include "base/basictypes.h" | |
8 #include "base/logging.h" | |
9 #include "media/base/decrypt_config.h" | |
10 #include "third_party/WebKit/public/platform/WebString.h" | |
11 #include "third_party/WebKit/public/platform/WebURL.h" | |
12 | |
13 namespace content { | |
14 | |
15 class WebContentDecryptionModuleSessionImpl | |
16 : public WebKit::WebContentDecryptionModuleSession { | |
17 public: | |
18 explicit WebContentDecryptionModuleSessionImpl( | |
19 WebKit::WebContentDecryptionModuleSession::Client* client); | |
20 virtual ~WebContentDecryptionModuleSessionImpl(); | |
21 | |
22 // WebKit::WebContentDecryptionModuleSession implementation. | |
23 virtual WebKit::WebString sessionId() const { return session_id_; } | |
24 virtual void generateKeyRequest(const WebKit::WebString& mime_type, | |
25 const uint8* init_data, | |
26 size_t init_data_length); | |
27 virtual void update(const uint8* key, size_t key_length); | |
28 virtual void close(); | |
29 | |
30 private: | |
31 WebKit::WebContentDecryptionModuleSession::Client* client_; | |
32 WebKit::WebString session_id_; | |
33 | |
34 DISALLOW_IMPLICIT_CONSTRUCTORS(WebContentDecryptionModuleSessionImpl); | |
jamesr
2013/06/13 02:04:18
this class has a constructor (it's public, even),
ddorwin
2013/06/13 05:51:37
Done.
| |
35 }; | |
36 | |
37 WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( | |
38 WebKit::WebContentDecryptionModuleSession::Client* client) | |
39 : client_(client) { | |
40 // TODO(ddorwin): Populate session_id_ from the real implementation. | |
41 } | |
42 | |
43 WebContentDecryptionModuleSessionImpl:: | |
44 ~WebContentDecryptionModuleSessionImpl() { | |
45 } | |
46 | |
47 void WebContentDecryptionModuleSessionImpl::generateKeyRequest( | |
48 const WebKit::WebString& mime_type, | |
49 const uint8* init_data, size_t init_data_length) { | |
50 // TODO(ddorwin): Call a real implementation and remove stub event triggers. | |
51 NOTIMPLEMENTED(); | |
52 client_->keyMessage(NULL, 0, WebKit::WebURL()); | |
53 } | |
54 | |
55 void WebContentDecryptionModuleSessionImpl::update(const uint8* key, | |
56 size_t key_length) { | |
57 DCHECK(key); | |
58 | |
59 // TODO(ddorwin): Call a real implementation and remove stub event triggers. | |
60 NOTIMPLEMENTED(); | |
61 // TODO(ddorwin): Remove when we have a real implementation that passes tests. | |
62 if (key_length != media::DecryptConfig::kDecryptionKeySize) { | |
63 client_->keyError( | |
64 WebKit::WebContentDecryptionModuleSession::Client:: | |
65 MediaKeyErrorCodeUnknown, | |
66 0); | |
67 return; | |
68 } | |
69 client_->keyAdded(); | |
70 } | |
71 | |
72 void WebContentDecryptionModuleSessionImpl::close() { | |
73 // TODO(ddorwin): Call a real implementation. | |
74 NOTIMPLEMENTED(); | |
75 } | |
76 | |
77 //------------------------------------------------------------------------------ | |
78 | |
79 WebContentDecryptionModuleImpl* | |
80 WebContentDecryptionModuleImpl::Create(const string16& key_system) { | |
81 // TODO(ddorwin): Verify we can create the internal objects & load CDM first. | |
82 return new WebContentDecryptionModuleImpl(key_system); | |
83 } | |
84 | |
85 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( | |
86 const string16& key_system) { | |
87 } | |
88 | |
89 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { | |
90 } | |
91 | |
92 WebKit::WebContentDecryptionModuleSession* | |
93 WebContentDecryptionModuleImpl::createSession( | |
94 WebKit::WebContentDecryptionModuleSession::Client* client) { | |
95 return new WebContentDecryptionModuleSessionImpl(client); | |
96 } | |
97 | |
98 } // namespace content | |
OLD | NEW |