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