| 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 #ifndef MEDIA_CDM_PPAPI_PPAPI_CDM_ADAPTER_H_ | 5 #ifndef MEDIA_CDM_PPAPI_PPAPI_CDM_ADAPTER_H_ |
| 6 #define MEDIA_CDM_PPAPI_PPAPI_CDM_ADAPTER_H_ | 6 #define MEDIA_CDM_PPAPI_PPAPI_CDM_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "media/cdm/api/content_decryption_module.h" | 14 #include "media/cdm/api/content_decryption_module.h" |
| 15 #include "media/cdm/cdm_helpers.h" | 15 #include "media/cdm/cdm_helpers.h" |
| 16 #include "media/cdm/cdm_wrapper.h" | 16 #include "media/cdm/cdm_wrapper.h" |
| 17 #include "media/cdm/ppapi/linked_ptr.h" | 17 #include "media/cdm/ppapi/linked_ptr.h" |
| 18 #include "media/cdm/ppapi/ppapi_cdm_buffer.h" | 18 #include "media/cdm/ppapi/ppapi_cdm_buffer.h" |
| 19 #include "ppapi/c/pp_stdint.h" | 19 #include "ppapi/c/pp_stdint.h" |
| 20 #include "ppapi/c/private/pp_content_decryptor.h" | 20 #include "ppapi/c/private/pp_content_decryptor.h" |
| 21 #include "ppapi/cpp/completion_callback.h" | 21 #include "ppapi/cpp/completion_callback.h" |
| 22 #include "ppapi/cpp/private/content_decryptor_private.h" | 22 #include "ppapi/cpp/private/content_decryptor_private.h" |
| 23 #include "ppapi/cpp/private/output_protection_private.h" |
| 23 #include "ppapi/cpp/var.h" | 24 #include "ppapi/cpp/var.h" |
| 24 #include "ppapi/cpp/var_array_buffer.h" | 25 #include "ppapi/cpp/var_array_buffer.h" |
| 25 #include "ppapi/utility/completion_callback_factory.h" | 26 #include "ppapi/utility/completion_callback_factory.h" |
| 26 | 27 |
| 27 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
| 28 #include "ppapi/cpp/private/output_protection_private.h" | |
| 29 #include "ppapi/cpp/private/platform_verification.h" | 29 #include "ppapi/cpp/private/platform_verification.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 namespace media { | 32 namespace media { |
| 33 | 33 |
| 34 // GetCdmHostFunc implementation. | 34 // GetCdmHostFunc implementation. |
| 35 void* GetCdmHost(int host_interface_version, void* user_data); | 35 void* GetCdmHost(int host_interface_version, void* user_data); |
| 36 | 36 |
| 37 // An adapter class for abstracting away PPAPI interaction and threading for a | 37 // An adapter class for abstracting away PPAPI interaction and threading for a |
| 38 // Content Decryption Module (CDM). | 38 // Content Decryption Module (CDM). |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // Callback to report |file_size_bytes| of the first file read by FileIO. | 231 // Callback to report |file_size_bytes| of the first file read by FileIO. |
| 232 void OnFirstFileRead(int32_t file_size_bytes); | 232 void OnFirstFileRead(int32_t file_size_bytes); |
| 233 | 233 |
| 234 #if !defined(NDEBUG) | 234 #if !defined(NDEBUG) |
| 235 // Logs the given message to the JavaScript console associated with the | 235 // Logs the given message to the JavaScript console associated with the |
| 236 // CDM adapter instance. The name of the CDM adapter issuing the log message | 236 // CDM adapter instance. The name of the CDM adapter issuing the log message |
| 237 // will be automatically prepended to the message. | 237 // will be automatically prepended to the message. |
| 238 void LogToConsole(const pp::Var& value); | 238 void LogToConsole(const pp::Var& value); |
| 239 #endif // !defined(NDEBUG) | 239 #endif // !defined(NDEBUG) |
| 240 | 240 |
| 241 #if defined(OS_CHROMEOS) | |
| 242 void ReportOutputProtectionUMA(OutputProtectionStatus status); | 241 void ReportOutputProtectionUMA(OutputProtectionStatus status); |
| 243 void ReportOutputProtectionQuery(); | 242 void ReportOutputProtectionQuery(); |
| 244 void ReportOutputProtectionQueryResult(); | 243 void ReportOutputProtectionQueryResult(); |
| 245 | 244 |
| 245 void EnableProtectionDone(int32_t result); |
| 246 void QueryOutputProtectionStatusDone(int32_t result); |
| 247 |
| 248 #if defined(OS_CHROMEOS) |
| 246 struct PepperPlatformChallengeResponse { | 249 struct PepperPlatformChallengeResponse { |
| 247 pp::Var signed_data; | 250 pp::Var signed_data; |
| 248 pp::Var signed_data_signature; | 251 pp::Var signed_data_signature; |
| 249 pp::Var platform_key_certificate; | 252 pp::Var platform_key_certificate; |
| 250 }; | 253 }; |
| 251 | 254 |
| 252 void SendPlatformChallengeDone( | 255 void SendPlatformChallengeDone( |
| 253 int32_t result, | 256 int32_t result, |
| 254 const linked_ptr<PepperPlatformChallengeResponse>& response); | 257 const linked_ptr<PepperPlatformChallengeResponse>& response); |
| 255 void EnableProtectionDone(int32_t result); | 258 #endif |
| 256 void QueryOutputProtectionStatusDone(int32_t result); | |
| 257 | 259 |
| 258 pp::OutputProtection_Private output_protection_; | 260 pp::OutputProtection_Private output_protection_; |
| 259 pp::PlatformVerification platform_verification_; | |
| 260 | 261 |
| 261 // Same as above, these are only read by QueryOutputProtectionStatusDone(). | 262 // Same as above, these are only read by QueryOutputProtectionStatusDone(). |
| 262 uint32_t output_link_mask_; | 263 uint32_t output_link_mask_; |
| 263 uint32_t output_protection_mask_; | 264 uint32_t output_protection_mask_; |
| 264 bool query_output_protection_in_progress_; | 265 bool query_output_protection_in_progress_; |
| 265 | 266 |
| 266 // Tracks whether an output protection query and a positive query result (no | 267 // Tracks whether an output protection query and a positive query result (no |
| 267 // unprotected external link) have been reported to UMA. | 268 // unprotected external link) have been reported to UMA. |
| 268 bool uma_for_output_protection_query_reported_; | 269 bool uma_for_output_protection_query_reported_; |
| 269 bool uma_for_output_protection_positive_result_reported_; | 270 bool uma_for_output_protection_positive_result_reported_; |
| 271 |
| 272 #if defined(OS_CHROMEOS) |
| 273 pp::PlatformVerification platform_verification_; |
| 270 #endif | 274 #endif |
| 271 | 275 |
| 272 PpbBufferAllocator allocator_; | 276 PpbBufferAllocator allocator_; |
| 273 pp::CompletionCallbackFactory<PpapiCdmAdapter> callback_factory_; | 277 pp::CompletionCallbackFactory<PpapiCdmAdapter> callback_factory_; |
| 274 linked_ptr<CdmWrapper> cdm_; | 278 linked_ptr<CdmWrapper> cdm_; |
| 275 std::string key_system_; | 279 std::string key_system_; |
| 276 bool allow_distinctive_identifier_; | 280 bool allow_distinctive_identifier_; |
| 277 bool allow_persistent_state_; | 281 bool allow_persistent_state_; |
| 278 | 282 |
| 279 // If the CDM returned kDeferredInitialization during InitializeAudioDecoder() | 283 // If the CDM returned kDeferredInitialization during InitializeAudioDecoder() |
| 280 // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is | 284 // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is |
| 281 // saved for the future call to OnDeferredInitializationDone(). | 285 // saved for the future call to OnDeferredInitializationDone(). |
| 282 bool deferred_initialize_audio_decoder_; | 286 bool deferred_initialize_audio_decoder_; |
| 283 uint32_t deferred_audio_decoder_config_id_; | 287 uint32_t deferred_audio_decoder_config_id_; |
| 284 bool deferred_initialize_video_decoder_; | 288 bool deferred_initialize_video_decoder_; |
| 285 uint32_t deferred_video_decoder_config_id_; | 289 uint32_t deferred_video_decoder_config_id_; |
| 286 | 290 |
| 287 uint32_t last_read_file_size_kb_; | 291 uint32_t last_read_file_size_kb_; |
| 288 bool file_size_uma_reported_; | 292 bool file_size_uma_reported_; |
| 289 | 293 |
| 290 DISALLOW_COPY_AND_ASSIGN(PpapiCdmAdapter); | 294 DISALLOW_COPY_AND_ASSIGN(PpapiCdmAdapter); |
| 291 }; | 295 }; |
| 292 | 296 |
| 293 } // namespace media | 297 } // namespace media |
| 294 | 298 |
| 295 #endif // MEDIA_CDM_PPAPI_PPAPI_CDM_ADAPTER_H_ | 299 #endif // MEDIA_CDM_PPAPI_PPAPI_CDM_ADAPTER_H_ |
| OLD | NEW |