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" | |
24 #include "ppapi/cpp/var.h" | 23 #include "ppapi/cpp/var.h" |
25 #include "ppapi/cpp/var_array_buffer.h" | 24 #include "ppapi/cpp/var_array_buffer.h" |
26 #include "ppapi/utility/completion_callback_factory.h" | 25 #include "ppapi/utility/completion_callback_factory.h" |
27 | 26 |
28 #if defined(OS_CHROMEOS) | 27 #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) |
241 void ReportOutputProtectionUMA(OutputProtectionStatus status); | 242 void ReportOutputProtectionUMA(OutputProtectionStatus status); |
242 void ReportOutputProtectionQuery(); | 243 void ReportOutputProtectionQuery(); |
243 void ReportOutputProtectionQueryResult(); | 244 void ReportOutputProtectionQueryResult(); |
244 | 245 |
245 void EnableProtectionDone(int32_t result); | |
246 void QueryOutputProtectionStatusDone(int32_t result); | |
247 | |
248 #if defined(OS_CHROMEOS) | |
249 struct PepperPlatformChallengeResponse { | 246 struct PepperPlatformChallengeResponse { |
250 pp::Var signed_data; | 247 pp::Var signed_data; |
251 pp::Var signed_data_signature; | 248 pp::Var signed_data_signature; |
252 pp::Var platform_key_certificate; | 249 pp::Var platform_key_certificate; |
253 }; | 250 }; |
254 | 251 |
255 void SendPlatformChallengeDone( | 252 void SendPlatformChallengeDone( |
256 int32_t result, | 253 int32_t result, |
257 const linked_ptr<PepperPlatformChallengeResponse>& response); | 254 const linked_ptr<PepperPlatformChallengeResponse>& response); |
258 #endif | 255 void EnableProtectionDone(int32_t result); |
| 256 void QueryOutputProtectionStatusDone(int32_t result); |
259 | 257 |
260 pp::OutputProtection_Private output_protection_; | 258 pp::OutputProtection_Private output_protection_; |
| 259 pp::PlatformVerification platform_verification_; |
261 | 260 |
262 // Same as above, these are only read by QueryOutputProtectionStatusDone(). | 261 // Same as above, these are only read by QueryOutputProtectionStatusDone(). |
263 uint32_t output_link_mask_; | 262 uint32_t output_link_mask_; |
264 uint32_t output_protection_mask_; | 263 uint32_t output_protection_mask_; |
265 bool query_output_protection_in_progress_; | 264 bool query_output_protection_in_progress_; |
266 | 265 |
267 // Tracks whether an output protection query and a positive query result (no | 266 // Tracks whether an output protection query and a positive query result (no |
268 // unprotected external link) have been reported to UMA. | 267 // unprotected external link) have been reported to UMA. |
269 bool uma_for_output_protection_query_reported_; | 268 bool uma_for_output_protection_query_reported_; |
270 bool uma_for_output_protection_positive_result_reported_; | 269 bool uma_for_output_protection_positive_result_reported_; |
271 | |
272 #if defined(OS_CHROMEOS) | |
273 pp::PlatformVerification platform_verification_; | |
274 #endif | 270 #endif |
275 | 271 |
276 PpbBufferAllocator allocator_; | 272 PpbBufferAllocator allocator_; |
277 pp::CompletionCallbackFactory<PpapiCdmAdapter> callback_factory_; | 273 pp::CompletionCallbackFactory<PpapiCdmAdapter> callback_factory_; |
278 linked_ptr<CdmWrapper> cdm_; | 274 linked_ptr<CdmWrapper> cdm_; |
279 std::string key_system_; | 275 std::string key_system_; |
280 bool allow_distinctive_identifier_; | 276 bool allow_distinctive_identifier_; |
281 bool allow_persistent_state_; | 277 bool allow_persistent_state_; |
282 | 278 |
283 // If the CDM returned kDeferredInitialization during InitializeAudioDecoder() | 279 // If the CDM returned kDeferredInitialization during InitializeAudioDecoder() |
284 // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is | 280 // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is |
285 // saved for the future call to OnDeferredInitializationDone(). | 281 // saved for the future call to OnDeferredInitializationDone(). |
286 bool deferred_initialize_audio_decoder_; | 282 bool deferred_initialize_audio_decoder_; |
287 uint32_t deferred_audio_decoder_config_id_; | 283 uint32_t deferred_audio_decoder_config_id_; |
288 bool deferred_initialize_video_decoder_; | 284 bool deferred_initialize_video_decoder_; |
289 uint32_t deferred_video_decoder_config_id_; | 285 uint32_t deferred_video_decoder_config_id_; |
290 | 286 |
291 uint32_t last_read_file_size_kb_; | 287 uint32_t last_read_file_size_kb_; |
292 bool file_size_uma_reported_; | 288 bool file_size_uma_reported_; |
293 | 289 |
294 DISALLOW_COPY_AND_ASSIGN(PpapiCdmAdapter); | 290 DISALLOW_COPY_AND_ASSIGN(PpapiCdmAdapter); |
295 }; | 291 }; |
296 | 292 |
297 } // namespace media | 293 } // namespace media |
298 | 294 |
299 #endif // MEDIA_CDM_PPAPI_PPAPI_CDM_ADAPTER_H_ | 295 #endif // MEDIA_CDM_PPAPI_PPAPI_CDM_ADAPTER_H_ |
OLD | NEW |