| 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/proxy/ppp_content_decryptor_private_proxy.h" | 5 #include "ppapi/proxy/ppp_content_decryptor_private_proxy.h" |
| 6 | 6 |
| 7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
| 8 #include "media/base/limits.h" | 8 #include "media/base/limits.h" |
| 9 #include "ppapi/c/pp_bool.h" | 9 #include "ppapi/c/pp_bool.h" |
| 10 #include "ppapi/c/ppb_core.h" | 10 #include "ppapi/c/ppb_core.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 &handle) == PP_FALSE) | 105 &handle) == PP_FALSE) |
| 106 return false; | 106 return false; |
| 107 | 107 |
| 108 buffer->resource = host_resource; | 108 buffer->resource = host_resource; |
| 109 buffer->handle = handle; | 109 buffer->handle = handle; |
| 110 buffer->size = size; | 110 buffer->size = size; |
| 111 return true; | 111 return true; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void Initialize(PP_Instance instance, | 114 void Initialize(PP_Instance instance, |
| 115 PP_Var key_system) { | 115 PP_Var key_system, |
| 116 PP_Bool allow_distinctive_identifier, |
| 117 PP_Bool allow_persistent_state) { |
| 116 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 118 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 117 if (!dispatcher) { | 119 if (!dispatcher) { |
| 118 NOTREACHED(); | 120 NOTREACHED(); |
| 119 return; | 121 return; |
| 120 } | 122 } |
| 121 | 123 |
| 122 dispatcher->Send( | 124 dispatcher->Send( |
| 123 new PpapiMsg_PPPContentDecryptor_Initialize( | 125 new PpapiMsg_PPPContentDecryptor_Initialize( |
| 124 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, | 126 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, |
| 125 instance, | 127 instance, |
| 126 SerializedVarSendInput(dispatcher, key_system))); | 128 SerializedVarSendInput(dispatcher, key_system), |
| 129 allow_distinctive_identifier, |
| 130 allow_persistent_state)); |
| 127 } | 131 } |
| 128 | 132 |
| 129 void SetServerCertificate(PP_Instance instance, | 133 void SetServerCertificate(PP_Instance instance, |
| 130 uint32_t promise_id, | 134 uint32_t promise_id, |
| 131 PP_Var server_certificate) { | 135 PP_Var server_certificate) { |
| 132 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 136 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 133 if (!dispatcher) { | 137 if (!dispatcher) { |
| 134 NOTREACHED(); | 138 NOTREACHED(); |
| 135 return; | 139 return; |
| 136 } | 140 } |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_DecryptAndDecode, | 517 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_DecryptAndDecode, |
| 514 OnMsgDecryptAndDecode) | 518 OnMsgDecryptAndDecode) |
| 515 IPC_MESSAGE_UNHANDLED(handled = false) | 519 IPC_MESSAGE_UNHANDLED(handled = false) |
| 516 IPC_END_MESSAGE_MAP() | 520 IPC_END_MESSAGE_MAP() |
| 517 DCHECK(handled); | 521 DCHECK(handled); |
| 518 return handled; | 522 return handled; |
| 519 } | 523 } |
| 520 | 524 |
| 521 void PPP_ContentDecryptor_Private_Proxy::OnMsgInitialize( | 525 void PPP_ContentDecryptor_Private_Proxy::OnMsgInitialize( |
| 522 PP_Instance instance, | 526 PP_Instance instance, |
| 523 SerializedVarReceiveInput key_system) { | 527 SerializedVarReceiveInput key_system, |
| 528 PP_Bool allow_distinctive_identifier, |
| 529 PP_Bool allow_persistent_state) { |
| 524 if (ppp_decryptor_impl_) { | 530 if (ppp_decryptor_impl_) { |
| 525 CallWhileUnlocked( | 531 CallWhileUnlocked( |
| 526 ppp_decryptor_impl_->Initialize, | 532 ppp_decryptor_impl_->Initialize, |
| 527 instance, | 533 instance, |
| 528 ExtractReceivedVarAndAddRef(dispatcher(), &key_system)); | 534 ExtractReceivedVarAndAddRef(dispatcher(), &key_system), |
| 535 allow_distinctive_identifier, |
| 536 allow_persistent_state); |
| 529 } | 537 } |
| 530 } | 538 } |
| 531 | 539 |
| 532 void PPP_ContentDecryptor_Private_Proxy::OnMsgSetServerCertificate( | 540 void PPP_ContentDecryptor_Private_Proxy::OnMsgSetServerCertificate( |
| 533 PP_Instance instance, | 541 PP_Instance instance, |
| 534 uint32_t promise_id, | 542 uint32_t promise_id, |
| 535 std::vector<uint8_t> server_certificate) { | 543 std::vector<uint8_t> server_certificate) { |
| 536 if (server_certificate.size() < media::limits::kMinCertificateLength || | 544 if (server_certificate.size() < media::limits::kMinCertificateLength || |
| 537 server_certificate.size() > media::limits::kMaxCertificateLength) { | 545 server_certificate.size() > media::limits::kMaxCertificateLength) { |
| 538 NOTREACHED(); | 546 NOTREACHED(); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 ppp_decryptor_impl_->DecryptAndDecode, | 745 ppp_decryptor_impl_->DecryptAndDecode, |
| 738 instance, | 746 instance, |
| 739 decoder_type, | 747 decoder_type, |
| 740 plugin_resource.get(), | 748 plugin_resource.get(), |
| 741 &block_info); | 749 &block_info); |
| 742 } | 750 } |
| 743 } | 751 } |
| 744 | 752 |
| 745 } // namespace proxy | 753 } // namespace proxy |
| 746 } // namespace ppapi | 754 } // namespace ppapi |
| OLD | NEW |