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 "ppapi/cpp/private/content_decryptor_private.h" | 5 #include "ppapi/cpp/private/content_decryptor_private.h" |
| 6 | 6 |
| 7 #include <cstring> // memcpy | 7 #include <cstring> // memcpy |
| 8 | 8 |
| 9 #include "ppapi/c/ppb_var.h" | 9 #include "ppapi/c/ppb_var.h" |
| 10 #include "ppapi/c/private/ppb_content_decryptor_private.h" | 10 #include "ppapi/c/private/ppb_content_decryptor_private.h" |
| 11 #include "ppapi/c/private/ppp_content_decryptor_private.h" | 11 #include "ppapi/c/private/ppp_content_decryptor_private.h" |
| 12 #include "ppapi/cpp/instance.h" | 12 #include "ppapi/cpp/instance.h" |
| 13 #include "ppapi/cpp/instance_handle.h" | 13 #include "ppapi/cpp/instance_handle.h" |
| 14 #include "ppapi/cpp/logging.h" | 14 #include "ppapi/cpp/logging.h" |
| 15 #include "ppapi/cpp/module.h" | 15 #include "ppapi/cpp/module.h" |
| 16 #include "ppapi/cpp/module_impl.h" | 16 #include "ppapi/cpp/module_impl.h" |
| 17 #include "ppapi/cpp/var.h" | 17 #include "ppapi/cpp/var.h" |
| 18 | 18 |
| 19 namespace pp { | 19 namespace pp { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 static const char kPPPContentDecryptorInterface[] = | 23 static const char kPPPContentDecryptorInterface[] = |
| 24 PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE; | 24 PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE; |
| 25 | 25 |
| 26 void GenerateKeyRequest(PP_Instance instance, | 26 void GenerateKeyRequest(PP_Instance instance, |
| 27 PP_Var key_system_arg, | 27 PP_Var key_system_arg, |
| 28 PP_Var mime_type_arg, | |
| 28 PP_Var init_data_arg) { | 29 PP_Var init_data_arg) { |
| 29 void* object = | 30 void* object = |
| 30 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 31 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| 31 if (!object) | 32 if (!object) |
| 32 return; | 33 return; |
| 33 | 34 |
| 34 pp::Var key_system_var(pp::PASS_REF, key_system_arg); | 35 pp::Var key_system_var(pp::PASS_REF, key_system_arg); |
| 35 if (key_system_var.is_string() == false) | 36 if (key_system_var.is_string() == false) |
| 36 return; | 37 return; |
| 37 | 38 |
| 39 pp::Var mime_type_var(pp::PASS_REF, mime_type_arg); | |
| 40 if (mime_type_var.is_string() == false) | |
|
xhwang
2012/10/26 06:19:30
not sure if it's ppapi's conventon, but why not ju
ddorwin
2012/10/26 18:37:06
Just to verify, "" will pass this, right?
Tom Finegan
2012/10/26 22:51:33
xhwang's comment: Done.
ddorwin's comment: Works o
| |
| 41 return; | |
| 42 | |
| 38 pp::Var init_data_var(pp::PASS_REF, init_data_arg); | 43 pp::Var init_data_var(pp::PASS_REF, init_data_arg); |
| 39 if (init_data_var.is_array_buffer() == false) | 44 if (init_data_var.is_array_buffer() == false) |
| 40 return; | 45 return; |
| 41 pp::VarArrayBuffer init_data_array_buffer(init_data_var); | 46 pp::VarArrayBuffer init_data_array_buffer(init_data_var); |
| 42 | 47 |
| 43 static_cast<ContentDecryptor_Private*>(object)->GenerateKeyRequest( | 48 static_cast<ContentDecryptor_Private*>(object)->GenerateKeyRequest( |
| 44 key_system_var.AsString(), | 49 key_system_var.AsString(), |
| 50 mime_type_var.AsString(), | |
| 45 init_data_array_buffer); | 51 init_data_array_buffer); |
| 46 } | 52 } |
| 47 | 53 |
| 48 void AddKey(PP_Instance instance, | 54 void AddKey(PP_Instance instance, |
| 49 PP_Var session_id_arg, | 55 PP_Var session_id_arg, |
| 50 PP_Var key_arg, | 56 PP_Var key_arg, |
| 51 PP_Var init_data_arg) { | 57 PP_Var init_data_arg) { |
| 52 void* object = | 58 void* object = |
| 53 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 59 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| 54 if (!object) | 60 if (!object) |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 const PP_DecryptedBlockInfo& decrypted_block_info) { | 337 const PP_DecryptedBlockInfo& decrypted_block_info) { |
| 332 if (has_interface<PPB_ContentDecryptor_Private>()) { | 338 if (has_interface<PPB_ContentDecryptor_Private>()) { |
| 333 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( | 339 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( |
| 334 associated_instance_.pp_instance(), | 340 associated_instance_.pp_instance(), |
| 335 audio_frames.pp_resource(), | 341 audio_frames.pp_resource(), |
| 336 &decrypted_block_info); | 342 &decrypted_block_info); |
| 337 } | 343 } |
| 338 } | 344 } |
| 339 | 345 |
| 340 } // namespace pp | 346 } // namespace pp |
| OLD | NEW |