Chromium Code Reviews| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 weak_this_(weak_ptr_factory_.GetWeakPtr()), | 236 weak_this_(weak_ptr_factory_.GetWeakPtr()), |
| 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( |
| 247 // TODO(ddorwin): Add an Initialize method to PPP_ContentDecryptor_Private. | 247 const std::string& key_system, |
| 248 const PP_KeySystemFlags key_system_flags) { | |
|
DaleCurtis
2013/09/18 21:29:30
const&
jrummell
2013/09/19 00:37:28
Done.
| |
| 248 DCHECK(!key_system.empty()); | 249 DCHECK(!key_system.empty()); |
| 250 DCHECK(key_system_.empty()); | |
| 251 | |
|
ddorwin
2013/09/18 21:26:53
nit: I would put this after the assignment, which
jrummell
2013/09/19 00:37:28
Done.
| |
| 249 key_system_ = key_system; | 252 key_system_ = key_system; |
| 253 plugin_decryption_interface_->Initialize( | |
| 254 pp_instance_, | |
| 255 StringVar::StringToPPVar(key_system_), | |
| 256 &key_system_flags); | |
|
ddorwin
2013/09/18 21:26:53
Why address of? It's input only.
jrummell
2013/09/19 00:37:28
The .idl generated interface is const struct PP_Cd
| |
| 250 } | 257 } |
| 251 | 258 |
| 252 void ContentDecryptorDelegate::SetKeyEventCallbacks( | 259 void ContentDecryptorDelegate::SetKeyEventCallbacks( |
| 253 const media::KeyAddedCB& key_added_cb, | 260 const media::KeyAddedCB& key_added_cb, |
| 254 const media::KeyErrorCB& key_error_cb, | 261 const media::KeyErrorCB& key_error_cb, |
| 255 const media::KeyMessageCB& key_message_cb) { | 262 const media::KeyMessageCB& key_message_cb) { |
| 256 key_added_cb_ = key_added_cb; | 263 key_added_cb_ = key_added_cb; |
| 257 key_error_cb_ = key_error_cb; | 264 key_error_cb_ = key_error_cb; |
| 258 key_message_cb_ = key_message_cb; | 265 key_message_cb_ = key_message_cb; |
| 259 } | 266 } |
| 260 | 267 |
| 261 bool ContentDecryptorDelegate::GenerateKeyRequest(const std::string& type, | 268 bool ContentDecryptorDelegate::GenerateKeyRequest(const std::string& type, |
| 262 const uint8* init_data, | 269 const uint8* init_data, |
| 263 int init_data_length) { | 270 int init_data_length) { |
| 264 PP_Var init_data_array = | 271 PP_Var init_data_array = |
| 265 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( | 272 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( |
| 266 init_data_length, init_data); | 273 init_data_length, init_data); |
| 267 | 274 |
| 268 plugin_decryption_interface_->GenerateKeyRequest( | 275 plugin_decryption_interface_->GenerateKeyRequest( |
| 269 pp_instance_, | 276 pp_instance_, |
| 270 StringVar::StringToPPVar(key_system_), // TODO(ddorwin): Remove. | |
| 271 StringVar::StringToPPVar(type), | 277 StringVar::StringToPPVar(type), |
| 272 init_data_array); | 278 init_data_array); |
| 273 return true; | 279 return true; |
| 274 } | 280 } |
| 275 | 281 |
| 276 bool ContentDecryptorDelegate::AddKey(const std::string& session_id, | 282 bool ContentDecryptorDelegate::AddKey(const std::string& session_id, |
| 277 const uint8* key, | 283 const uint8* key, |
| 278 int key_length, | 284 int key_length, |
| 279 const uint8* init_data, | 285 const uint8* init_data, |
| 280 int init_data_length) { | 286 int init_data_length) { |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1042 frames->push_back(frame); | 1048 frames->push_back(frame); |
| 1043 | 1049 |
| 1044 cur += frame_size; | 1050 cur += frame_size; |
| 1045 bytes_left -= frame_size; | 1051 bytes_left -= frame_size; |
| 1046 } while (bytes_left > 0); | 1052 } while (bytes_left > 0); |
| 1047 | 1053 |
| 1048 return true; | 1054 return true; |
| 1049 } | 1055 } |
| 1050 | 1056 |
| 1051 } // namespace content | 1057 } // namespace content |
| OLD | NEW |