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 DCHECK(destination_url_string); | |
788 | |
789 GURL verified_gurl = GURL(destination_url_string->value()); | |
790 if (!verified_gurl.is_valid() && !verified_gurl.is_empty()) { | |
791 DLOG(WARNING) << "SessionMessage default_url is invalid : " | |
xhwang
2015/01/13 18:45:13
Just note: It's sad to have both destination url a
jrummell
2015/01/13 19:46:31
Changed message since default_url not used here.
| |
792 << verified_gurl.possibly_invalid_spec(); | |
793 verified_gurl = GURL::EmptyGURL(); // Replace invalid destination_url. | |
794 } | |
795 | |
784 session_message_cb_.Run(web_session_id_string->value(), | 796 session_message_cb_.Run(web_session_id_string->value(), |
785 PpCdmMessageTypeToMediaMessageType(message_type), | 797 PpCdmMessageTypeToMediaMessageType(message_type), |
786 message_vector); | 798 message_vector, verified_gurl); |
787 } | 799 } |
788 | 800 |
789 void ContentDecryptorDelegate::OnSessionKeysChange( | 801 void ContentDecryptorDelegate::OnSessionKeysChange( |
790 PP_Var web_session_id, | 802 PP_Var web_session_id, |
791 PP_Bool has_additional_usable_key, | 803 PP_Bool has_additional_usable_key, |
792 uint32_t key_count, | 804 uint32_t key_count, |
793 const struct PP_KeyInformation key_information[]) { | 805 const struct PP_KeyInformation key_information[]) { |
794 if (session_keys_change_cb_.is_null()) | 806 if (session_keys_change_cb_.is_null()) |
795 return; | 807 return; |
796 | 808 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1280 empty_frames); | 1292 empty_frames); |
1281 } | 1293 } |
1282 | 1294 |
1283 if (!video_decode_cb_.is_null()) | 1295 if (!video_decode_cb_.is_null()) |
1284 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); | 1296 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); |
1285 | 1297 |
1286 cdm_promise_adapter_.Clear(); | 1298 cdm_promise_adapter_.Clear(); |
1287 } | 1299 } |
1288 | 1300 |
1289 } // namespace content | 1301 } // namespace content |
OLD | NEW |