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 "content/renderer/pepper/content_decryptor_delegate.h" | 5 #include "content/renderer/pepper/content_decryptor_delegate.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 DCHECK(promise); | 760 DCHECK(promise); |
761 if (promise) { | 761 if (promise) { |
762 promise->reject(PpExceptionTypeToMediaException(exception_code), | 762 promise->reject(PpExceptionTypeToMediaException(exception_code), |
763 system_code, | 763 system_code, |
764 error_description_string->value()); | 764 error_description_string->value()); |
765 } | 765 } |
766 } | 766 } |
767 | 767 |
768 void ContentDecryptorDelegate::OnSessionMessage(PP_Var web_session_id, | 768 void ContentDecryptorDelegate::OnSessionMessage(PP_Var web_session_id, |
769 PP_CdmMessageType message_type, | 769 PP_CdmMessageType message_type, |
770 PP_Var message) { | 770 PP_Var message, |
| 771 PP_Var legacy_destination_url) { |
771 if (session_message_cb_.is_null()) | 772 if (session_message_cb_.is_null()) |
772 return; | 773 return; |
773 | 774 |
774 StringVar* web_session_id_string = StringVar::FromPPVar(web_session_id); | 775 StringVar* web_session_id_string = StringVar::FromPPVar(web_session_id); |
775 DCHECK(web_session_id_string); | 776 DCHECK(web_session_id_string); |
776 | 777 |
777 ArrayBufferVar* message_array_buffer = ArrayBufferVar::FromPPVar(message); | 778 ArrayBufferVar* message_array_buffer = ArrayBufferVar::FromPPVar(message); |
778 std::vector<uint8> message_vector; | 779 std::vector<uint8> message_vector; |
779 if (message_array_buffer) { | 780 if (message_array_buffer) { |
780 const uint8* data = static_cast<const uint8*>(message_array_buffer->Map()); | 781 const uint8* data = static_cast<const uint8*>(message_array_buffer->Map()); |
781 message_vector.assign(data, data + message_array_buffer->ByteLength()); | 782 message_vector.assign(data, data + message_array_buffer->ByteLength()); |
782 } | 783 } |
783 | 784 |
| 785 StringVar* destination_url_string = |
| 786 StringVar::FromPPVar(legacy_destination_url); |
| 787 if (!destination_url_string) { |
| 788 NOTREACHED(); |
| 789 return; |
| 790 } |
| 791 |
| 792 GURL verified_gurl = GURL(destination_url_string->value()); |
| 793 if (!verified_gurl.is_valid()) { |
| 794 DLOG(WARNING) << "SessionMessage legacy_destination_url is invalid : " |
| 795 << verified_gurl.possibly_invalid_spec(); |
| 796 verified_gurl = GURL::EmptyGURL(); // Replace invalid destination_url. |
| 797 } |
| 798 |
784 session_message_cb_.Run(web_session_id_string->value(), | 799 session_message_cb_.Run(web_session_id_string->value(), |
785 PpCdmMessageTypeToMediaMessageType(message_type), | 800 PpCdmMessageTypeToMediaMessageType(message_type), |
786 message_vector); | 801 message_vector, verified_gurl); |
787 } | 802 } |
788 | 803 |
789 void ContentDecryptorDelegate::OnSessionKeysChange( | 804 void ContentDecryptorDelegate::OnSessionKeysChange( |
790 PP_Var web_session_id, | 805 PP_Var web_session_id, |
791 PP_Bool has_additional_usable_key, | 806 PP_Bool has_additional_usable_key, |
792 uint32_t key_count, | 807 uint32_t key_count, |
793 const struct PP_KeyInformation key_information[]) { | 808 const struct PP_KeyInformation key_information[]) { |
794 if (session_keys_change_cb_.is_null()) | 809 if (session_keys_change_cb_.is_null()) |
795 return; | 810 return; |
796 | 811 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 empty_frames); | 1295 empty_frames); |
1281 } | 1296 } |
1282 | 1297 |
1283 if (!video_decode_cb_.is_null()) | 1298 if (!video_decode_cb_.is_null()) |
1284 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); | 1299 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); |
1285 | 1300 |
1286 cdm_promise_adapter_.Clear(); | 1301 cdm_promise_adapter_.Clear(); |
1287 } | 1302 } |
1288 | 1303 |
1289 } // namespace content | 1304 } // namespace content |
OLD | NEW |