| 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 #include "ppapi/cpp/var_array.h" | 18 #include "ppapi/cpp/var_array.h" |
| 19 | 19 |
| 20 namespace pp { | 20 namespace pp { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 static const char kPPPContentDecryptorInterface[] = | 24 static const char kPPPContentDecryptorInterface[] = |
| 25 PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE; | 25 PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE; |
| 26 | 26 |
| 27 void Initialize(PP_Instance instance, | 27 void Initialize(PP_Instance instance, |
| 28 uint32_t promise_id, |
| 28 PP_Var key_system_arg, | 29 PP_Var key_system_arg, |
| 29 PP_Bool allow_distinctive_identifier, | 30 PP_Bool allow_distinctive_identifier, |
| 30 PP_Bool allow_persistent_state) { | 31 PP_Bool allow_persistent_state) { |
| 31 void* object = | 32 void* object = |
| 32 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 33 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| 33 if (!object) | 34 if (!object) |
| 34 return; | 35 return; |
| 35 | 36 |
| 36 pp::Var key_system_var(pp::PASS_REF, key_system_arg); | 37 pp::Var key_system_var(pp::PASS_REF, key_system_arg); |
| 37 if (!key_system_var.is_string()) | 38 if (!key_system_var.is_string()) |
| 38 return; | 39 return; |
| 39 | 40 |
| 40 static_cast<ContentDecryptor_Private*>(object)->Initialize( | 41 static_cast<ContentDecryptor_Private*>(object) |
| 41 key_system_var.AsString(), | 42 ->Initialize(promise_id, key_system_var.AsString(), |
| 42 PP_ToBool(allow_distinctive_identifier), | 43 PP_ToBool(allow_distinctive_identifier), |
| 43 PP_ToBool(allow_persistent_state)); | 44 PP_ToBool(allow_persistent_state)); |
| 44 } | 45 } |
| 45 | 46 |
| 46 void SetServerCertificate(PP_Instance instance, | 47 void SetServerCertificate(PP_Instance instance, |
| 47 uint32_t promise_id, | 48 uint32_t promise_id, |
| 48 PP_Var server_certificate_arg) { | 49 PP_Var server_certificate_arg) { |
| 49 void* object = | 50 void* object = |
| 50 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 51 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| 51 if (!object) | 52 if (!object) |
| 52 return; | 53 return; |
| 53 | 54 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 const PP_DecryptedSampleInfo& decrypted_sample_info) { | 430 const PP_DecryptedSampleInfo& decrypted_sample_info) { |
| 430 if (has_interface<PPB_ContentDecryptor_Private>()) { | 431 if (has_interface<PPB_ContentDecryptor_Private>()) { |
| 431 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( | 432 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( |
| 432 associated_instance_.pp_instance(), | 433 associated_instance_.pp_instance(), |
| 433 audio_frames.pp_resource(), | 434 audio_frames.pp_resource(), |
| 434 &decrypted_sample_info); | 435 &decrypted_sample_info); |
| 435 } | 436 } |
| 436 } | 437 } |
| 437 | 438 |
| 438 } // namespace pp | 439 } // namespace pp |
| OLD | NEW |