| 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 PP_Var key_system_arg) { | 28 PP_Var key_system_arg, |
| 29 PP_Bool allow_distinctive_identifier, |
| 30 PP_Bool allow_persistent_state) { |
| 29 void* object = | 31 void* object = |
| 30 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 32 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| 31 if (!object) | 33 if (!object) |
| 32 return; | 34 return; |
| 33 | 35 |
| 34 pp::Var key_system_var(pp::PASS_REF, key_system_arg); | 36 pp::Var key_system_var(pp::PASS_REF, key_system_arg); |
| 35 if (!key_system_var.is_string()) | 37 if (!key_system_var.is_string()) |
| 36 return; | 38 return; |
| 37 | 39 |
| 38 static_cast<ContentDecryptor_Private*>(object)->Initialize( | 40 static_cast<ContentDecryptor_Private*>(object)->Initialize( |
| 39 key_system_var.AsString()); | 41 key_system_var.AsString(), |
| 42 PP_ToBool(allow_distinctive_identifier), |
| 43 PP_ToBool(allow_persistent_state)); |
| 40 } | 44 } |
| 41 | 45 |
| 42 void SetServerCertificate(PP_Instance instance, | 46 void SetServerCertificate(PP_Instance instance, |
| 43 uint32_t promise_id, | 47 uint32_t promise_id, |
| 44 PP_Var server_certificate_arg) { | 48 PP_Var server_certificate_arg) { |
| 45 void* object = | 49 void* object = |
| 46 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 50 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| 47 if (!object) | 51 if (!object) |
| 48 return; | 52 return; |
| 49 | 53 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 const PP_DecryptedSampleInfo& decrypted_sample_info) { | 434 const PP_DecryptedSampleInfo& decrypted_sample_info) { |
| 431 if (has_interface<PPB_ContentDecryptor_Private>()) { | 435 if (has_interface<PPB_ContentDecryptor_Private>()) { |
| 432 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( | 436 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( |
| 433 associated_instance_.pp_instance(), | 437 associated_instance_.pp_instance(), |
| 434 audio_frames.pp_resource(), | 438 audio_frames.pp_resource(), |
| 435 &decrypted_sample_info); | 439 &decrypted_sample_info); |
| 436 } | 440 } |
| 437 } | 441 } |
| 438 | 442 |
| 439 } // namespace pp | 443 } // namespace pp |
| OLD | NEW |