Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/crypto/ppapi_decryptor.h" | 5 #include "content/renderer/media/crypto/ppapi_decryptor.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 const uint8* response, | 130 const uint8* response, |
| 131 int response_length) { | 131 int response_length) { |
| 132 DVLOG(2) << __FUNCTION__; | 132 DVLOG(2) << __FUNCTION__; |
| 133 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 133 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 134 | 134 |
| 135 if (!plugin_cdm_delegate_ || !plugin_cdm_delegate_->UpdateSession( | 135 if (!plugin_cdm_delegate_ || !plugin_cdm_delegate_->UpdateSession( |
| 136 session_id, response, response_length)) { | 136 session_id, response, response_length)) { |
| 137 ReportFailureToCallPlugin(session_id); | 137 ReportFailureToCallPlugin(session_id); |
| 138 return; | 138 return; |
| 139 } | 139 } |
| 140 | |
| 141 if (!new_audio_key_cb_.is_null()) | |
| 142 new_audio_key_cb_.Run(); | |
| 143 | |
| 144 if (!new_video_key_cb_.is_null()) | |
| 145 new_video_key_cb_.Run(); | |
| 146 } | 140 } |
| 147 | 141 |
| 148 void PpapiDecryptor::ReleaseSession(uint32 session_id) { | 142 void PpapiDecryptor::ReleaseSession(uint32 session_id) { |
| 149 DVLOG(2) << __FUNCTION__; | 143 DVLOG(2) << __FUNCTION__; |
| 150 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 144 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 151 | 145 |
| 152 if (!plugin_cdm_delegate_ || | 146 if (!plugin_cdm_delegate_ || |
| 153 !plugin_cdm_delegate_->ReleaseSession(session_id)) { | 147 !plugin_cdm_delegate_->ReleaseSession(session_id)) { |
| 154 ReportFailureToCallPlugin(session_id); | 148 ReportFailureToCallPlugin(session_id); |
| 155 return; | 149 return; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 | 339 |
| 346 void PpapiDecryptor::OnSessionMessage(uint32 session_id, | 340 void PpapiDecryptor::OnSessionMessage(uint32 session_id, |
| 347 const std::vector<uint8>& message, | 341 const std::vector<uint8>& message, |
| 348 const std::string& destination_url) { | 342 const std::string& destination_url) { |
| 349 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 343 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 350 session_message_cb_.Run(session_id, message, destination_url); | 344 session_message_cb_.Run(session_id, message, destination_url); |
| 351 } | 345 } |
| 352 | 346 |
| 353 void PpapiDecryptor::OnSessionReady(uint32 session_id) { | 347 void PpapiDecryptor::OnSessionReady(uint32 session_id) { |
| 354 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 348 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 349 | |
| 350 if (!new_audio_key_cb_.is_null()) | |
|
ddorwin
2014/02/19 00:04:09
Step 3.5 of the update() algorithm is:
If the asso
xhwang
2014/02/19 00:24:23
Done.
| |
| 351 new_audio_key_cb_.Run(); | |
| 352 | |
| 353 if (!new_video_key_cb_.is_null()) | |
| 354 new_video_key_cb_.Run(); | |
| 355 | |
| 355 session_ready_cb_.Run(session_id); | 356 session_ready_cb_.Run(session_id); |
| 356 } | 357 } |
| 357 | 358 |
| 358 void PpapiDecryptor::OnSessionClosed(uint32 session_id) { | 359 void PpapiDecryptor::OnSessionClosed(uint32 session_id) { |
| 359 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 360 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 360 session_closed_cb_.Run(session_id); | 361 session_closed_cb_.Run(session_id); |
| 361 } | 362 } |
| 362 | 363 |
| 363 void PpapiDecryptor::OnSessionError(uint32 session_id, | 364 void PpapiDecryptor::OnSessionError(uint32 session_id, |
| 364 media::MediaKeys::KeyError error_code, | 365 media::MediaKeys::KeyError error_code, |
| 365 int system_code) { | 366 int system_code) { |
| 366 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 367 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 367 session_error_cb_.Run(session_id, error_code, system_code); | 368 session_error_cb_.Run(session_id, error_code, system_code); |
| 368 } | 369 } |
| 369 | 370 |
| 370 void PpapiDecryptor::OnFatalPluginError() { | 371 void PpapiDecryptor::OnFatalPluginError() { |
| 371 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 372 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 372 DCHECK(plugin_cdm_delegate_); | 373 DCHECK(plugin_cdm_delegate_); |
| 373 plugin_cdm_delegate_ = NULL; | 374 plugin_cdm_delegate_ = NULL; |
| 374 plugin_instance_ = NULL; | 375 plugin_instance_ = NULL; |
| 375 base::ResetAndReturn(&destroy_plugin_cb_).Run(); | 376 base::ResetAndReturn(&destroy_plugin_cb_).Run(); |
| 376 } | 377 } |
| 377 | 378 |
| 378 } // namespace content | 379 } // namespace content |
| OLD | NEW |