Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 2255943002: EME: Remove obsolete legacy APIs related to versions of prefixed EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build and add bug reference for obsoletes Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string.h> 7 #include <string.h>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 ContentDecryptorDelegate::~ContentDecryptorDelegate() { 378 ContentDecryptorDelegate::~ContentDecryptorDelegate() {
379 SatisfyAllPendingCallbacksOnError(); 379 SatisfyAllPendingCallbacksOnError();
380 } 380 }
381 381
382 void ContentDecryptorDelegate::Initialize( 382 void ContentDecryptorDelegate::Initialize(
383 const std::string& key_system, 383 const std::string& key_system,
384 bool allow_distinctive_identifier, 384 bool allow_distinctive_identifier,
385 bool allow_persistent_state, 385 bool allow_persistent_state,
386 const media::SessionMessageCB& session_message_cb, 386 const media::SessionMessageCB& session_message_cb,
387 const media::SessionClosedCB& session_closed_cb, 387 const media::SessionClosedCB& session_closed_cb,
388 const media::LegacySessionErrorCB& legacy_session_error_cb,
389 const media::SessionKeysChangeCB& session_keys_change_cb, 388 const media::SessionKeysChangeCB& session_keys_change_cb,
390 const media::SessionExpirationUpdateCB& session_expiration_update_cb, 389 const media::SessionExpirationUpdateCB& session_expiration_update_cb,
391 const base::Closure& fatal_plugin_error_cb, 390 const base::Closure& fatal_plugin_error_cb,
392 std::unique_ptr<media::SimpleCdmPromise> promise) { 391 std::unique_ptr<media::SimpleCdmPromise> promise) {
393 DCHECK(!key_system.empty()); 392 DCHECK(!key_system.empty());
394 DCHECK(key_system_.empty()); 393 DCHECK(key_system_.empty());
395 key_system_ = key_system; 394 key_system_ = key_system;
396 395
397 session_message_cb_ = session_message_cb; 396 session_message_cb_ = session_message_cb;
398 session_closed_cb_ = session_closed_cb; 397 session_closed_cb_ = session_closed_cb;
399 legacy_session_error_cb_ = legacy_session_error_cb;
400 session_keys_change_cb_ = session_keys_change_cb; 398 session_keys_change_cb_ = session_keys_change_cb;
401 session_expiration_update_cb_ = session_expiration_update_cb; 399 session_expiration_update_cb_ = session_expiration_update_cb;
402 fatal_plugin_error_cb_ = fatal_plugin_error_cb; 400 fatal_plugin_error_cb_ = fatal_plugin_error_cb;
403 401
404 uint32_t promise_id = cdm_promise_adapter_.SavePromise(std::move(promise)); 402 uint32_t promise_id = cdm_promise_adapter_.SavePromise(std::move(promise));
405 plugin_decryption_interface_->Initialize( 403 plugin_decryption_interface_->Initialize(
406 pp_instance_, promise_id, StringVar::StringToPPVar(key_system_), 404 pp_instance_, promise_id, StringVar::StringToPPVar(key_system_),
407 PP_FromBool(allow_distinctive_identifier), 405 PP_FromBool(allow_distinctive_identifier),
408 PP_FromBool(allow_persistent_state)); 406 PP_FromBool(allow_persistent_state));
409 } 407 }
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 755
758 StringVar* error_description_string = StringVar::FromPPVar(error_description); 756 StringVar* error_description_string = StringVar::FromPPVar(error_description);
759 DCHECK(error_description_string); 757 DCHECK(error_description_string);
760 cdm_promise_adapter_.RejectPromise( 758 cdm_promise_adapter_.RejectPromise(
761 promise_id, PpExceptionTypeToMediaException(exception_code), system_code, 759 promise_id, PpExceptionTypeToMediaException(exception_code), system_code,
762 error_description_string->value()); 760 error_description_string->value());
763 } 761 }
764 762
765 void ContentDecryptorDelegate::OnSessionMessage(PP_Var session_id, 763 void ContentDecryptorDelegate::OnSessionMessage(PP_Var session_id,
766 PP_CdmMessageType message_type, 764 PP_CdmMessageType message_type,
767 PP_Var message, 765 PP_Var message) {
768 PP_Var legacy_destination_url) {
769 if (session_message_cb_.is_null()) 766 if (session_message_cb_.is_null())
770 return; 767 return;
771 768
772 StringVar* session_id_string = StringVar::FromPPVar(session_id); 769 StringVar* session_id_string = StringVar::FromPPVar(session_id);
773 DCHECK(session_id_string); 770 DCHECK(session_id_string);
774 771
775 ArrayBufferVar* message_array_buffer = ArrayBufferVar::FromPPVar(message); 772 ArrayBufferVar* message_array_buffer = ArrayBufferVar::FromPPVar(message);
776 std::vector<uint8_t> message_vector; 773 std::vector<uint8_t> message_vector;
777 if (message_array_buffer) { 774 if (message_array_buffer) {
778 const uint8_t* data = 775 const uint8_t* data =
779 static_cast<const uint8_t*>(message_array_buffer->Map()); 776 static_cast<const uint8_t*>(message_array_buffer->Map());
780 message_vector.assign(data, data + message_array_buffer->ByteLength()); 777 message_vector.assign(data, data + message_array_buffer->ByteLength());
781 } 778 }
782 779
783 StringVar* destination_url_string =
784 StringVar::FromPPVar(legacy_destination_url);
785 if (!destination_url_string) {
786 NOTREACHED();
787 return;
788 }
789
790 GURL verified_gurl = GURL(destination_url_string->value());
791 if (!verified_gurl.is_valid()) {
792 DLOG(WARNING) << "SessionMessage legacy_destination_url is invalid : "
793 << verified_gurl.possibly_invalid_spec();
794 verified_gurl = GURL::EmptyGURL(); // Replace invalid destination_url.
795 }
796
797 session_message_cb_.Run(session_id_string->value(), 780 session_message_cb_.Run(session_id_string->value(),
798 PpCdmMessageTypeToMediaMessageType(message_type), 781 PpCdmMessageTypeToMediaMessageType(message_type),
799 message_vector, verified_gurl); 782 message_vector);
800 } 783 }
801 784
802 void ContentDecryptorDelegate::OnSessionKeysChange( 785 void ContentDecryptorDelegate::OnSessionKeysChange(
803 PP_Var session_id, 786 PP_Var session_id,
804 PP_Bool has_additional_usable_key, 787 PP_Bool has_additional_usable_key,
805 uint32_t key_count, 788 uint32_t key_count,
806 const struct PP_KeyInformation key_information[]) { 789 const struct PP_KeyInformation key_information[]) {
807 if (session_keys_change_cb_.is_null()) 790 if (session_keys_change_cb_.is_null())
808 return; 791 return;
809 792
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 void ContentDecryptorDelegate::OnSessionClosed(PP_Var session_id) { 824 void ContentDecryptorDelegate::OnSessionClosed(PP_Var session_id) {
842 if (session_closed_cb_.is_null()) 825 if (session_closed_cb_.is_null())
843 return; 826 return;
844 827
845 StringVar* session_id_string = StringVar::FromPPVar(session_id); 828 StringVar* session_id_string = StringVar::FromPPVar(session_id);
846 DCHECK(session_id_string); 829 DCHECK(session_id_string);
847 830
848 session_closed_cb_.Run(session_id_string->value()); 831 session_closed_cb_.Run(session_id_string->value());
849 } 832 }
850 833
851 void ContentDecryptorDelegate::OnLegacySessionError(
852 PP_Var session_id,
853 PP_CdmExceptionCode exception_code,
854 uint32_t system_code,
855 PP_Var error_description) {
856 ReportSystemCodeUMA(key_system_, system_code);
857
858 if (legacy_session_error_cb_.is_null())
859 return;
860
861 StringVar* session_id_string = StringVar::FromPPVar(session_id);
862 DCHECK(session_id_string);
863
864 StringVar* error_description_string = StringVar::FromPPVar(error_description);
865 DCHECK(error_description_string);
866
867 legacy_session_error_cb_.Run(session_id_string->value(),
868 PpExceptionTypeToMediaException(exception_code),
869 system_code, error_description_string->value());
870 }
871
872 void ContentDecryptorDelegate::DecoderInitializeDone( 834 void ContentDecryptorDelegate::DecoderInitializeDone(
873 PP_DecryptorStreamType decoder_type, 835 PP_DecryptorStreamType decoder_type,
874 uint32_t request_id, 836 uint32_t request_id,
875 PP_Bool success) { 837 PP_Bool success) {
876 if (decoder_type == PP_DECRYPTORSTREAMTYPE_AUDIO) { 838 if (decoder_type == PP_DECRYPTORSTREAMTYPE_AUDIO) {
877 // If the request ID is not valid or does not match what's saved, do 839 // If the request ID is not valid or does not match what's saved, do
878 // nothing. 840 // nothing.
879 if (request_id == 0 || !audio_decoder_init_cb_.Matches(request_id)) 841 if (request_id == 0 || !audio_decoder_init_cb_.Matches(request_id))
880 return; 842 return;
881 843
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 empty_frames); 1254 empty_frames);
1293 } 1255 }
1294 1256
1295 if (!video_decode_cb_.is_null()) 1257 if (!video_decode_cb_.is_null())
1296 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); 1258 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL);
1297 1259
1298 cdm_promise_adapter_.Clear(); 1260 cdm_promise_adapter_.Clear();
1299 } 1261 }
1300 1262
1301 } // namespace content 1263 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698