OLD | NEW |
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 "content/renderer/pepper/content_decryptor_delegate.h" | 5 #include "content/renderer/pepper/content_decryptor_delegate.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 plugin_decryption_interface_->Initialize( | 279 plugin_decryption_interface_->Initialize( |
280 pp_instance_, StringVar::StringToPPVar(key_system_)); | 280 pp_instance_, StringVar::StringToPPVar(key_system_)); |
281 } | 281 } |
282 | 282 |
283 void ContentDecryptorDelegate::InstanceCrashed() { | 283 void ContentDecryptorDelegate::InstanceCrashed() { |
284 fatal_plugin_error_cb_.Run(); | 284 fatal_plugin_error_cb_.Run(); |
285 SatisfyAllPendingCallbacksOnError(); | 285 SatisfyAllPendingCallbacksOnError(); |
286 } | 286 } |
287 | 287 |
288 bool ContentDecryptorDelegate::CreateSession(uint32 session_id, | 288 bool ContentDecryptorDelegate::CreateSession(uint32 session_id, |
289 const std::string& type, | 289 const std::string& content_type, |
290 const uint8* init_data, | 290 const uint8* init_data, |
291 int init_data_length) { | 291 int init_data_length) { |
292 PP_Var init_data_array = | 292 PP_Var init_data_array = |
293 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( | 293 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( |
294 init_data_length, init_data); | 294 init_data_length, init_data); |
295 | 295 |
296 plugin_decryption_interface_->CreateSession(pp_instance_, | 296 plugin_decryption_interface_->CreateSession( |
297 session_id, | 297 pp_instance_, |
298 StringVar::StringToPPVar(type), | 298 session_id, |
299 init_data_array); | 299 StringVar::StringToPPVar(content_type), |
| 300 init_data_array); |
300 return true; | 301 return true; |
301 } | 302 } |
302 | 303 |
| 304 void ContentDecryptorDelegate::LoadSession(uint32 session_id, |
| 305 const std::string& web_session_id) { |
| 306 plugin_decryption_interface_->LoadSession( |
| 307 pp_instance_, session_id, StringVar::StringToPPVar(web_session_id)); |
| 308 } |
| 309 |
303 bool ContentDecryptorDelegate::UpdateSession(uint32 session_id, | 310 bool ContentDecryptorDelegate::UpdateSession(uint32 session_id, |
304 const uint8* response, | 311 const uint8* response, |
305 int response_length) { | 312 int response_length) { |
306 PP_Var response_array = | 313 PP_Var response_array = |
307 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( | 314 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( |
308 response_length, response); | 315 response_length, response); |
309 plugin_decryption_interface_->UpdateSession( | 316 plugin_decryption_interface_->UpdateSession( |
310 pp_instance_, session_id, response_array); | 317 pp_instance_, session_id, response_array); |
311 return true; | 318 return true; |
312 } | 319 } |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 const media::Decryptor::AudioBuffers empty_frames; | 1055 const media::Decryptor::AudioBuffers empty_frames; |
1049 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, | 1056 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, |
1050 empty_frames); | 1057 empty_frames); |
1051 } | 1058 } |
1052 | 1059 |
1053 if (!video_decode_cb_.is_null()) | 1060 if (!video_decode_cb_.is_null()) |
1054 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); | 1061 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); |
1055 } | 1062 } |
1056 | 1063 |
1057 } // namespace content | 1064 } // namespace content |
OLD | NEW |