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

Side by Side Diff: content/renderer/media/crypto/ppapi_decryptor.cc

Issue 19744007: Create a public API around webkit::ppapi::PluginInstance and use it in chrome. After this, webkit/p… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/media/crypto/ppapi_decryptor.h" 5 #include "content/renderer/media/crypto/ppapi_decryptor.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/message_loop/message_loop_proxy.h" 14 #include "base/message_loop/message_loop_proxy.h"
15 #include "media/base/audio_decoder_config.h" 15 #include "media/base/audio_decoder_config.h"
16 #include "media/base/data_buffer.h" 16 #include "media/base/data_buffer.h"
17 #include "media/base/decoder_buffer.h" 17 #include "media/base/decoder_buffer.h"
18 #include "media/base/video_decoder_config.h" 18 #include "media/base/video_decoder_config.h"
19 #include "media/base/video_frame.h" 19 #include "media/base/video_frame.h"
20 #include "webkit/plugins/ppapi/content_decryptor_delegate.h" 20 #include "webkit/plugins/ppapi/content_decryptor_delegate.h"
21 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 21 #include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h"
22 22
23 namespace content { 23 namespace content {
24 24
25 scoped_ptr<PpapiDecryptor> PpapiDecryptor::Create( 25 scoped_ptr<PpapiDecryptor> PpapiDecryptor::Create(
26 const std::string& key_system, 26 const std::string& key_system,
27 const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance, 27 const scoped_refptr<webkit::ppapi::PluginInstanceImpl>& plugin_instance,
28 const media::KeyAddedCB& key_added_cb, 28 const media::KeyAddedCB& key_added_cb,
29 const media::KeyErrorCB& key_error_cb, 29 const media::KeyErrorCB& key_error_cb,
30 const media::KeyMessageCB& key_message_cb, 30 const media::KeyMessageCB& key_message_cb,
31 const base::Closure& destroy_plugin_cb) { 31 const base::Closure& destroy_plugin_cb) {
32 webkit::ppapi::ContentDecryptorDelegate* plugin_cdm_delegate = 32 webkit::ppapi::ContentDecryptorDelegate* plugin_cdm_delegate =
33 plugin_instance->GetContentDecryptorDelegate(); 33 plugin_instance->GetContentDecryptorDelegate();
34 if (!plugin_cdm_delegate) { 34 if (!plugin_cdm_delegate) {
35 DVLOG(1) << "PpapiDecryptor: plugin cdm delegate creation failed."; 35 DVLOG(1) << "PpapiDecryptor: plugin cdm delegate creation failed.";
36 return scoped_ptr<PpapiDecryptor>(); 36 return scoped_ptr<PpapiDecryptor>();
37 } 37 }
38 38
39 plugin_cdm_delegate->Initialize(key_system); 39 plugin_cdm_delegate->Initialize(key_system);
40 40
41 return scoped_ptr<PpapiDecryptor>(new PpapiDecryptor(plugin_instance, 41 return scoped_ptr<PpapiDecryptor>(new PpapiDecryptor(plugin_instance,
42 plugin_cdm_delegate, 42 plugin_cdm_delegate,
43 key_added_cb, 43 key_added_cb,
44 key_error_cb, 44 key_error_cb,
45 key_message_cb, 45 key_message_cb,
46 destroy_plugin_cb)); 46 destroy_plugin_cb));
47 } 47 }
48 48
49 PpapiDecryptor::PpapiDecryptor( 49 PpapiDecryptor::PpapiDecryptor(
50 const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance, 50 const scoped_refptr<webkit::ppapi::PluginInstanceImpl>& plugin_instance,
51 webkit::ppapi::ContentDecryptorDelegate* plugin_cdm_delegate, 51 webkit::ppapi::ContentDecryptorDelegate* plugin_cdm_delegate,
52 const media::KeyAddedCB& key_added_cb, 52 const media::KeyAddedCB& key_added_cb,
53 const media::KeyErrorCB& key_error_cb, 53 const media::KeyErrorCB& key_error_cb,
54 const media::KeyMessageCB& key_message_cb, 54 const media::KeyMessageCB& key_message_cb,
55 const base::Closure& destroy_plugin_cb) 55 const base::Closure& destroy_plugin_cb)
56 : plugin_instance_(plugin_instance), 56 : plugin_instance_(plugin_instance),
57 plugin_cdm_delegate_(plugin_cdm_delegate), 57 plugin_cdm_delegate_(plugin_cdm_delegate),
58 key_added_cb_(key_added_cb), 58 key_added_cb_(key_added_cb),
59 key_error_cb_(key_error_cb), 59 key_error_cb_(key_error_cb),
60 key_message_cb_(key_message_cb), 60 key_message_cb_(key_message_cb),
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 299
300 void PpapiDecryptor::KeyMessage(const std::string& session_id, 300 void PpapiDecryptor::KeyMessage(const std::string& session_id,
301 const std::vector<uint8>& message, 301 const std::vector<uint8>& message,
302 const std::string& default_url) { 302 const std::string& default_url) {
303 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); 303 DCHECK(render_loop_proxy_->BelongsToCurrentThread());
304 key_message_cb_.Run(session_id, message, default_url); 304 key_message_cb_.Run(session_id, message, default_url);
305 } 305 }
306 306
307 } // namespace content 307 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698