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

Side by Side Diff: media/cdm/ppapi/ppapi_cdm_adapter.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 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 "media/cdm/ppapi/ppapi_cdm_adapter.h" 5 #include "media/cdm/ppapi/ppapi_cdm_adapter.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 SessionError(error, system_code, error_message))); 687 SessionError(error, system_code, error_message)));
688 } 688 }
689 689
690 void PpapiCdmAdapter::OnSessionMessage(const char* session_id, 690 void PpapiCdmAdapter::OnSessionMessage(const char* session_id,
691 uint32_t session_id_size, 691 uint32_t session_id_size,
692 cdm::MessageType message_type, 692 cdm::MessageType message_type,
693 const char* message, 693 const char* message,
694 uint32_t message_size, 694 uint32_t message_size,
695 const char* legacy_destination_url, 695 const char* legacy_destination_url,
696 uint32_t legacy_destination_url_size) { 696 uint32_t legacy_destination_url_size) {
697 // |legacy_destination_url| is obsolete and will be removed as part of
698 // https://crbug.com/570216.
697 // License requests should not specify |legacy_destination_url|. 699 // License requests should not specify |legacy_destination_url|.
698 // |legacy_destination_url| is not passed to unprefixed EME applications,
699 // so it can be removed when the prefixed API is removed.
700 PP_DCHECK(legacy_destination_url_size == 0 || 700 PP_DCHECK(legacy_destination_url_size == 0 ||
jrummell 2016/08/18 19:10:43 Since we're not passing |legacy_destination_url| o
ddorwin 2016/08/18 19:21:48 This is an assumption about the input from CDMs. I
701 message_type != cdm::MessageType::kLicenseRequest); 701 message_type != cdm::MessageType::kLicenseRequest);
702 702
703 PostOnMain(callback_factory_.NewCallback( 703 PostOnMain(callback_factory_.NewCallback(
704 &PpapiCdmAdapter::SendSessionMessageInternal, 704 &PpapiCdmAdapter::SendSessionMessageInternal,
705 SessionMessage( 705 SessionMessage(std::string(session_id, session_id_size), message_type,
706 std::string(session_id, session_id_size), message_type, message, 706 message, message_size)));
707 message_size,
708 std::string(legacy_destination_url, legacy_destination_url_size))));
709 } 707 }
710 708
711 void PpapiCdmAdapter::OnSessionKeysChange(const char* session_id, 709 void PpapiCdmAdapter::OnSessionKeysChange(const char* session_id,
712 uint32_t session_id_size, 710 uint32_t session_id_size,
713 bool has_additional_usable_key, 711 bool has_additional_usable_key,
714 const cdm::KeyInformation* keys_info, 712 const cdm::KeyInformation* keys_info,
715 uint32_t keys_info_count) { 713 uint32_t keys_info_count) {
716 std::vector<PP_KeyInformation> key_information; 714 std::vector<PP_KeyInformation> key_information;
717 for (uint32_t i = 0; i < keys_info_count; ++i) { 715 for (uint32_t i = 0; i < keys_info_count; ++i) {
718 const auto& key_info = keys_info[i]; 716 const auto& key_info = keys_info[i];
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 callback_factory_.NewCallback(&PpapiCdmAdapter::SendSessionClosedInternal, 751 callback_factory_.NewCallback(&PpapiCdmAdapter::SendSessionClosedInternal,
754 std::string(session_id, session_id_size))); 752 std::string(session_id, session_id_size)));
755 } 753 }
756 754
757 void PpapiCdmAdapter::OnLegacySessionError(const char* session_id, 755 void PpapiCdmAdapter::OnLegacySessionError(const char* session_id,
758 uint32_t session_id_size, 756 uint32_t session_id_size,
759 cdm::Error error, 757 cdm::Error error,
760 uint32_t system_code, 758 uint32_t system_code,
761 const char* error_message, 759 const char* error_message,
762 uint32_t error_message_size) { 760 uint32_t error_message_size) {
763 PostOnMain(callback_factory_.NewCallback( 761 // Obsolete and will be removed as part of https://crbug.com/570216.
764 &PpapiCdmAdapter::SendSessionErrorInternal,
765 std::string(session_id, session_id_size),
766 SessionError(error, system_code,
767 std::string(error_message, error_message_size))));
768 } 762 }
769 763
770 // Helpers to pass the event to Pepper. 764 // Helpers to pass the event to Pepper.
771 765
772 void PpapiCdmAdapter::SendPromiseResolvedInternal(int32_t result, 766 void PpapiCdmAdapter::SendPromiseResolvedInternal(int32_t result,
773 uint32_t promise_id) { 767 uint32_t promise_id) {
774 PP_DCHECK(result == PP_OK); 768 PP_DCHECK(result == PP_OK);
775 pp::ContentDecryptor_Private::PromiseResolved(promise_id); 769 pp::ContentDecryptor_Private::PromiseResolved(promise_id);
776 } 770 }
777 771
(...skipping 21 matching lines...) Expand all
799 PP_DCHECK(result == PP_OK); 793 PP_DCHECK(result == PP_OK);
800 794
801 pp::VarArrayBuffer message_array_buffer(message.message.size()); 795 pp::VarArrayBuffer message_array_buffer(message.message.size());
802 if (message.message.size() > 0) { 796 if (message.message.size() > 0) {
803 memcpy(message_array_buffer.Map(), message.message.data(), 797 memcpy(message_array_buffer.Map(), message.message.data(),
804 message.message.size()); 798 message.message.size());
805 } 799 }
806 800
807 pp::ContentDecryptor_Private::SessionMessage( 801 pp::ContentDecryptor_Private::SessionMessage(
808 message.session_id, CdmMessageTypeToPpMessageType(message.message_type), 802 message.session_id, CdmMessageTypeToPpMessageType(message.message_type),
809 message_array_buffer, message.legacy_destination_url); 803 message_array_buffer, std::string());
810 } 804 }
811 805
812 void PpapiCdmAdapter::SendSessionClosedInternal(int32_t result, 806 void PpapiCdmAdapter::SendSessionClosedInternal(int32_t result,
813 const std::string& session_id) { 807 const std::string& session_id) {
814 PP_DCHECK(result == PP_OK); 808 PP_DCHECK(result == PP_OK);
815 pp::ContentDecryptor_Private::SessionClosed(session_id); 809 pp::ContentDecryptor_Private::SessionClosed(session_id);
816 } 810 }
817 811
818 void PpapiCdmAdapter::SendSessionErrorInternal(int32_t result,
819 const std::string& session_id,
820 const SessionError& error) {
821 PP_DCHECK(result == PP_OK);
822 pp::ContentDecryptor_Private::LegacySessionError(
823 session_id, CdmExceptionTypeToPpCdmExceptionType(error.error),
824 error.system_code, error.error_description);
825 }
826
827 void PpapiCdmAdapter::SendSessionKeysChangeInternal( 812 void PpapiCdmAdapter::SendSessionKeysChangeInternal(
828 int32_t result, 813 int32_t result,
829 const std::string& session_id, 814 const std::string& session_id,
830 bool has_additional_usable_key, 815 bool has_additional_usable_key,
831 const std::vector<PP_KeyInformation>& key_info) { 816 const std::vector<PP_KeyInformation>& key_info) {
832 PP_DCHECK(result == PP_OK); 817 PP_DCHECK(result == PP_OK);
833 pp::ContentDecryptor_Private::SessionKeysChange( 818 pp::ContentDecryptor_Private::SessionKeysChange(
834 session_id, has_additional_usable_key, key_info); 819 session_id, has_additional_usable_key, key_info);
835 } 820 }
836 821
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 } 1221 }
1237 1222
1238 PpapiCdmAdapter::SessionError::SessionError( 1223 PpapiCdmAdapter::SessionError::SessionError(
1239 cdm::Error error, 1224 cdm::Error error,
1240 uint32_t system_code, 1225 uint32_t system_code,
1241 const std::string& error_description) 1226 const std::string& error_description)
1242 : error(error), 1227 : error(error),
1243 system_code(system_code), 1228 system_code(system_code),
1244 error_description(error_description) {} 1229 error_description(error_description) {}
1245 1230
1246 PpapiCdmAdapter::SessionMessage::SessionMessage( 1231 PpapiCdmAdapter::SessionMessage::SessionMessage(const std::string& session_id,
1247 const std::string& session_id, 1232 cdm::MessageType message_type,
1248 cdm::MessageType message_type, 1233 const char* message,
1249 const char* message, 1234 uint32_t message_size)
1250 uint32_t message_size,
1251 const std::string& legacy_destination_url)
1252 : session_id(session_id), 1235 : session_id(session_id),
1253 message_type(message_type), 1236 message_type(message_type),
1254 message(message, message + message_size), 1237 message(message, message + message_size) {}
1255 legacy_destination_url(legacy_destination_url) {}
1256 1238
1257 void* GetCdmHost(int host_interface_version, void* user_data) { 1239 void* GetCdmHost(int host_interface_version, void* user_data) {
1258 if (!host_interface_version || !user_data) 1240 if (!host_interface_version || !user_data)
1259 return NULL; 1241 return NULL;
1260 1242
1261 static_assert( 1243 static_assert(
1262 cdm::ContentDecryptionModule::Host::kVersion == cdm::Host_8::kVersion, 1244 cdm::ContentDecryptionModule::Host::kVersion == cdm::Host_8::kVersion,
1263 "update the code below"); 1245 "update the code below");
1264 1246
1265 // Ensure IsSupportedCdmHostVersion matches implementation of this function. 1247 // Ensure IsSupportedCdmHostVersion matches implementation of this function.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 } // namespace media 1295 } // namespace media
1314 1296
1315 namespace pp { 1297 namespace pp {
1316 1298
1317 // Factory function for your specialization of the Module object. 1299 // Factory function for your specialization of the Module object.
1318 Module* CreateModule() { 1300 Module* CreateModule() {
1319 return new media::PpapiCdmAdapterModule(); 1301 return new media::PpapiCdmAdapterModule();
1320 } 1302 }
1321 1303
1322 } // namespace pp 1304 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698