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

Side by Side Diff: webkit/media/crypto/proxy_decryptor.cc

Issue 10704241: Add PpapiDecryptor which wraps a CDM plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/media/crypto/proxy_decryptor.h" 5 #include "webkit/media/crypto/proxy_decryptor.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/decoder_buffer.h" 8 #include "media/base/decoder_buffer.h"
9 #include "media/base/decryptor_client.h" 9 #include "media/base/decryptor_client.h"
10 #include "media/crypto/aes_decryptor.h" 10 #include "media/crypto/aes_decryptor.h"
11 #include "webkit/media/crypto/key_systems.h" 11 #include "webkit/media/crypto/key_systems.h"
12 12
13 namespace webkit_media { 13 namespace webkit_media {
14 14
15 ProxyDecryptor::ProxyDecryptor(media::DecryptorClient* client) 15 ProxyDecryptor::ProxyDecryptor(media::DecryptorClient* client,
16 : client_(client) { 16 const CreatePluginCB& create_plugin_cb)
17 : client_(client),
18 create_plugin_cb_(create_plugin_cb) {
17 } 19 }
18 20
19 ProxyDecryptor::~ProxyDecryptor() { 21 ProxyDecryptor::~ProxyDecryptor() {
20 } 22 }
21 23
22 void ProxyDecryptor::GenerateKeyRequest(const std::string& key_system, 24 void ProxyDecryptor::GenerateKeyRequest(const std::string& key_system,
23 const uint8* init_data, 25 const uint8* init_data,
24 int init_data_length) { 26 int init_data_length) {
25 // We do not support run-time switching of decryptors. GenerateKeyRequest() 27 // We do not support run-time switching of decryptors. GenerateKeyRequest()
26 // only creates a new decryptor when |decryptor_| is not initialized. 28 // only creates a new decryptor when |decryptor_| is not initialized.
27 if (!decryptor_.get()) { 29 if (!decryptor_.get()) {
28 base::AutoLock auto_lock(lock_); 30 base::AutoLock auto_lock(lock_);
29 decryptor_ = CreateDecryptor(key_system, client_); 31 decryptor_ = CreateDecryptor(key_system, client_, create_plugin_cb_);
ddorwin 2012/07/17 21:31:28 As mentioned in ppapi_decryptor.cc, I think we sho
xhwang 2012/07/18 19:43:17 Done.
30 } 32 }
31 33
32 DCHECK(decryptor_.get()); 34 DCHECK(decryptor_.get());
33 decryptor_->GenerateKeyRequest(key_system, init_data, init_data_length); 35 decryptor_->GenerateKeyRequest(key_system, init_data, init_data_length);
34 } 36 }
35 37
36 void ProxyDecryptor::AddKey(const std::string& key_system, 38 void ProxyDecryptor::AddKey(const std::string& key_system,
37 const uint8* key, 39 const uint8* key,
38 int key_length, 40 int key_length,
39 const uint8* init_data, 41 const uint8* init_data,
(...skipping 21 matching lines...) Expand all
61 base::AutoLock auto_lock(lock_); 63 base::AutoLock auto_lock(lock_);
62 decryptor = decryptor_.get(); 64 decryptor = decryptor_.get();
63 } 65 }
64 if (!decryptor) 66 if (!decryptor)
65 decrypt_cb.Run(kError, NULL); 67 decrypt_cb.Run(kError, NULL);
66 68
67 return decryptor->Decrypt(encrypted, decrypt_cb); 69 return decryptor->Decrypt(encrypted, decrypt_cb);
68 } 70 }
69 71
70 } // namespace webkit_media 72 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698