| 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/safe_numerics.h" | 10 #include "base/safe_numerics.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 audio_sample_format_(media::kUnknownSampleFormat), | 237 audio_sample_format_(media::kUnknownSampleFormat), |
| 238 audio_samples_per_second_(0), | 238 audio_samples_per_second_(0), |
| 239 audio_channel_count_(0), | 239 audio_channel_count_(0), |
| 240 audio_bytes_per_frame_(0) { | 240 audio_bytes_per_frame_(0) { |
| 241 } | 241 } |
| 242 | 242 |
| 243 ContentDecryptorDelegate::~ContentDecryptorDelegate() { | 243 ContentDecryptorDelegate::~ContentDecryptorDelegate() { |
| 244 } | 244 } |
| 245 | 245 |
| 246 void ContentDecryptorDelegate::Initialize(const std::string& key_system) { | 246 void ContentDecryptorDelegate::Initialize(const std::string& key_system) { |
| 247 // TODO(ddorwin): Add an Initialize method to PPP_ContentDecryptor_Private. | |
| 248 DCHECK(!key_system.empty()); | 247 DCHECK(!key_system.empty()); |
| 248 DCHECK(key_system_.empty()); |
| 249 key_system_ = key_system; | 249 key_system_ = key_system; |
| 250 plugin_decryption_interface_->Initialize( |
| 251 pp_instance_, |
| 252 StringVar::StringToPPVar(key_system_)); |
| 250 } | 253 } |
| 251 | 254 |
| 252 void ContentDecryptorDelegate::SetKeyEventCallbacks( | 255 void ContentDecryptorDelegate::SetKeyEventCallbacks( |
| 253 const media::KeyAddedCB& key_added_cb, | 256 const media::KeyAddedCB& key_added_cb, |
| 254 const media::KeyErrorCB& key_error_cb, | 257 const media::KeyErrorCB& key_error_cb, |
| 255 const media::KeyMessageCB& key_message_cb) { | 258 const media::KeyMessageCB& key_message_cb) { |
| 256 key_added_cb_ = key_added_cb; | 259 key_added_cb_ = key_added_cb; |
| 257 key_error_cb_ = key_error_cb; | 260 key_error_cb_ = key_error_cb; |
| 258 key_message_cb_ = key_message_cb; | 261 key_message_cb_ = key_message_cb; |
| 259 } | 262 } |
| 260 | 263 |
| 261 bool ContentDecryptorDelegate::GenerateKeyRequest(const std::string& type, | 264 bool ContentDecryptorDelegate::GenerateKeyRequest(const std::string& type, |
| 262 const uint8* init_data, | 265 const uint8* init_data, |
| 263 int init_data_length) { | 266 int init_data_length) { |
| 264 PP_Var init_data_array = | 267 PP_Var init_data_array = |
| 265 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( | 268 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( |
| 266 init_data_length, init_data); | 269 init_data_length, init_data); |
| 267 | 270 |
| 268 plugin_decryption_interface_->GenerateKeyRequest( | 271 plugin_decryption_interface_->GenerateKeyRequest( |
| 269 pp_instance_, | 272 pp_instance_, |
| 270 StringVar::StringToPPVar(key_system_), // TODO(ddorwin): Remove. | |
| 271 StringVar::StringToPPVar(type), | 273 StringVar::StringToPPVar(type), |
| 272 init_data_array); | 274 init_data_array); |
| 273 return true; | 275 return true; |
| 274 } | 276 } |
| 275 | 277 |
| 276 bool ContentDecryptorDelegate::AddKey(const std::string& session_id, | 278 bool ContentDecryptorDelegate::AddKey(const std::string& session_id, |
| 277 const uint8* key, | 279 const uint8* key, |
| 278 int key_length, | 280 int key_length, |
| 279 const uint8* init_data, | 281 const uint8* init_data, |
| 280 int init_data_length) { | 282 int init_data_length) { |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 frames->push_back(frame); | 1044 frames->push_back(frame); |
| 1043 | 1045 |
| 1044 cur += frame_size; | 1046 cur += frame_size; |
| 1045 bytes_left -= frame_size; | 1047 bytes_left -= frame_size; |
| 1046 } while (bytes_left > 0); | 1048 } while (bytes_left > 0); |
| 1047 | 1049 |
| 1048 return true; | 1050 return true; |
| 1049 } | 1051 } |
| 1050 | 1052 |
| 1051 } // namespace content | 1053 } // namespace content |
| OLD | NEW |