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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
11 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/stl_util.h" |
12 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
13 #include "base/time.h" | 16 #include "base/time.h" |
14 #include "base/utf_offset_string_conversions.h" | 17 #include "base/utf_offset_string_conversions.h" |
15 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "media/base/decoder_buffer.h" |
| 20 #include "media/base/decryptor_client.h" |
| 21 #include "ppapi/c/dev/pp_decryption_buffer_dev.h" |
16 #include "ppapi/c/dev/ppb_find_dev.h" | 22 #include "ppapi/c/dev/ppb_find_dev.h" |
17 #include "ppapi/c/dev/ppb_zoom_dev.h" | 23 #include "ppapi/c/dev/ppb_zoom_dev.h" |
18 #include "ppapi/c/dev/ppp_find_dev.h" | 24 #include "ppapi/c/dev/ppp_find_dev.h" |
19 #include "ppapi/c/dev/ppp_selection_dev.h" | 25 #include "ppapi/c/dev/ppp_selection_dev.h" |
20 #include "ppapi/c/dev/ppp_text_input_dev.h" | 26 #include "ppapi/c/dev/ppp_text_input_dev.h" |
21 #include "ppapi/c/dev/ppp_zoom_dev.h" | 27 #include "ppapi/c/dev/ppp_zoom_dev.h" |
22 #include "ppapi/c/pp_rect.h" | 28 #include "ppapi/c/pp_rect.h" |
23 #include "ppapi/c/ppb_audio_config.h" | 29 #include "ppapi/c/ppb_audio_config.h" |
24 #include "ppapi/c/ppb_core.h" | 30 #include "ppapi/c/ppb_core.h" |
25 #include "ppapi/c/ppb_gamepad.h" | 31 #include "ppapi/c/ppb_gamepad.h" |
26 #include "ppapi/c/ppp_input_event.h" | 32 #include "ppapi/c/ppp_input_event.h" |
27 #include "ppapi/c/ppp_instance.h" | 33 #include "ppapi/c/ppp_instance.h" |
28 #include "ppapi/c/ppp_messaging.h" | 34 #include "ppapi/c/ppp_messaging.h" |
29 #include "ppapi/c/ppp_mouse_lock.h" | 35 #include "ppapi/c/ppp_mouse_lock.h" |
30 #include "ppapi/c/private/ppp_instance_private.h" | 36 #include "ppapi/c/private/ppp_instance_private.h" |
31 #include "ppapi/shared_impl/ppb_input_event_shared.h" | 37 #include "ppapi/shared_impl/ppb_input_event_shared.h" |
32 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 38 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
| 39 #include "ppapi/shared_impl/ppb_var_shared.h" |
33 #include "ppapi/shared_impl/ppb_view_shared.h" | 40 #include "ppapi/shared_impl/ppb_view_shared.h" |
34 #include "ppapi/shared_impl/ppp_instance_combined.h" | 41 #include "ppapi/shared_impl/ppp_instance_combined.h" |
35 #include "ppapi/shared_impl/resource.h" | 42 #include "ppapi/shared_impl/resource.h" |
36 #include "ppapi/shared_impl/scoped_pp_resource.h" | 43 #include "ppapi/shared_impl/scoped_pp_resource.h" |
37 #include "ppapi/shared_impl/time_conversion.h" | 44 #include "ppapi/shared_impl/time_conversion.h" |
38 #include "ppapi/shared_impl/var.h" | 45 #include "ppapi/shared_impl/var.h" |
39 #include "ppapi/thunk/enter.h" | 46 #include "ppapi/thunk/enter.h" |
40 #include "ppapi/thunk/ppb_buffer_api.h" | 47 #include "ppapi/thunk/ppb_buffer_api.h" |
41 #include "printing/units.h" | 48 #include "printing/units.h" |
42 #include "third_party/skia/include/core/SkCanvas.h" | 49 #include "third_party/skia/include/core/SkCanvas.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 scoped_array<const char*> array(new const char*[vector.size()]); | 298 scoped_array<const char*> array(new const char*[vector.size()]); |
292 for (size_t i = 0; i < vector.size(); ++i) | 299 for (size_t i = 0; i < vector.size(); ++i) |
293 array[i] = vector[i].c_str(); | 300 array[i] = vector[i].c_str(); |
294 return array.Pass(); | 301 return array.Pass(); |
295 } | 302 } |
296 | 303 |
297 // Creates a PP_Resource containing a PPB_Buffer_Impl, copies |data| into the | 304 // Creates a PP_Resource containing a PPB_Buffer_Impl, copies |data| into the |
298 // buffer resource, and returns it. Returns a PP_Resource equal to 0 on | 305 // buffer resource, and returns it. Returns a PP_Resource equal to 0 on |
299 // failure. | 306 // failure. |
300 PP_Resource MakeBufferResource(PP_Instance instance, | 307 PP_Resource MakeBufferResource(PP_Instance instance, |
301 const std::string& data) { | 308 const char* data, size_t size) { |
302 if (data.empty()) | 309 if (!data) |
303 return 0; | 310 return 0; |
304 | 311 |
305 ScopedPPResource resource(PPB_Buffer_Impl::Create(instance, data.size())); | 312 ScopedPPResource resource(PPB_Buffer_Impl::Create(instance, size)); |
306 if (!resource.get()) | 313 if (!resource.get()) |
307 return 0; | 314 return 0; |
308 | 315 |
309 EnterResourceNoLock<PPB_Buffer_API> enter(resource, true); | 316 EnterResourceNoLock<PPB_Buffer_API> enter(resource, true); |
310 if (enter.failed()) | 317 if (enter.failed()) |
311 return 0; | 318 return 0; |
312 | 319 |
313 BufferAutoMapper mapper(enter.object()); | 320 BufferAutoMapper mapper(enter.object()); |
314 if (!mapper.data() || mapper.size() < data.size()) | 321 if (!mapper.data() || mapper.size() < size) |
315 return 0; | 322 return 0; |
316 memcpy(mapper.data(), data.data(), data.size()); | 323 memcpy(mapper.data(), data, size); |
317 | 324 |
318 // Add the resource to the tracker... | 325 // Add the resource to the tracker... |
319 // TODO(tomfinegan): wild guess/no idea if this is right. | 326 // TODO(tomfinegan): wild guess/no idea if this is right. |
320 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(resource.get()); | 327 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(resource.get()); |
321 | 328 |
322 return resource.Release(); | 329 return resource.Release(); |
323 } | 330 } |
324 | 331 |
325 } // namespace | 332 } // namespace |
326 | 333 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 sad_plugin_(NULL), | 380 sad_plugin_(NULL), |
374 input_event_mask_(0), | 381 input_event_mask_(0), |
375 filtered_input_event_mask_(0), | 382 filtered_input_event_mask_(0), |
376 text_input_type_(kPluginDefaultTextInputType), | 383 text_input_type_(kPluginDefaultTextInputType), |
377 text_input_caret_(0, 0, 0, 0), | 384 text_input_caret_(0, 0, 0, 0), |
378 text_input_caret_bounds_(0, 0, 0, 0), | 385 text_input_caret_bounds_(0, 0, 0, 0), |
379 text_input_caret_set_(false), | 386 text_input_caret_set_(false), |
380 selection_caret_(0), | 387 selection_caret_(0), |
381 selection_anchor_(0), | 388 selection_anchor_(0), |
382 pending_user_gesture_(0.0), | 389 pending_user_gesture_(0.0), |
383 flash_impl_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 390 flash_impl_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 391 decryptor_client_(NULL), |
| 392 next_decryption_buffer_id_(0) { |
384 pp_instance_ = HostGlobals::Get()->AddInstance(this); | 393 pp_instance_ = HostGlobals::Get()->AddInstance(this); |
385 | 394 |
386 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); | 395 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); |
387 DCHECK(delegate); | 396 DCHECK(delegate); |
388 module_->InstanceCreated(this); | 397 module_->InstanceCreated(this); |
389 delegate_->InstanceCreated(this); | 398 delegate_->InstanceCreated(this); |
390 message_channel_.reset(new MessageChannel(this)); | 399 message_channel_.reset(new MessageChannel(this)); |
391 | 400 |
392 view_data_.is_page_visible = delegate->IsPageVisible(); | 401 view_data_.is_page_visible = delegate->IsPageVisible(); |
393 | 402 |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 if (!LoadPdfInterface()) | 1319 if (!LoadPdfInterface()) |
1311 return; | 1320 return; |
1312 PP_PrivatePageTransformType transform_type = | 1321 PP_PrivatePageTransformType transform_type = |
1313 type == WebPlugin::RotationType90Clockwise ? | 1322 type == WebPlugin::RotationType90Clockwise ? |
1314 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW : | 1323 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW : |
1315 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW; | 1324 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW; |
1316 plugin_pdf_interface_->Transform(pp_instance(), transform_type); | 1325 plugin_pdf_interface_->Transform(pp_instance(), transform_type); |
1317 // NOTE: plugin instance may have been deleted. | 1326 // NOTE: plugin instance may have been deleted. |
1318 } | 1327 } |
1319 | 1328 |
| 1329 void PluginInstance::SetDecryptClient( |
| 1330 media::DecryptorClient* decryptor_client) { |
| 1331 DCHECK(decryptor_client); |
| 1332 decryptor_client_ = decryptor_client; |
| 1333 } |
| 1334 |
1320 bool PluginInstance::GenerateKeyRequest(const std::string& key_system, | 1335 bool PluginInstance::GenerateKeyRequest(const std::string& key_system, |
1321 const std::string& init_data) { | 1336 const std::string& init_data) { |
1322 if (!LoadContentDecryptionModuleInterface()) | 1337 if (!LoadContentDecryptionModuleInterface()) |
1323 return false; | 1338 return false; |
1324 | 1339 |
1325 if (key_system.empty()) | 1340 if (key_system.empty()) |
1326 return false; | 1341 return false; |
1327 | 1342 |
1328 PP_Resource init_data_resource = 0; | 1343 PP_Resource init_data_resource = 0; |
1329 if (init_data.size()) { | 1344 if (init_data.size()) { |
1330 ScopedPPResource local_init_data(ScopedPPResource::PassRef(), | 1345 ScopedPPResource local_init_data(ScopedPPResource::PassRef(), |
1331 MakeBufferResource(pp_instance(), | 1346 MakeBufferResource(pp_instance(), |
1332 init_data)); | 1347 init_data.data(), |
| 1348 init_data.size())); |
1333 | 1349 |
1334 if (!local_init_data.get()) | 1350 if (!local_init_data.get()) |
1335 return false; | 1351 return false; |
1336 init_data_resource = local_init_data.Release(); | 1352 init_data_resource = local_init_data.Release(); |
1337 } | 1353 } |
1338 | 1354 |
1339 return PP_ToBool(plugin_decryption_interface_->GenerateKeyRequest( | 1355 return PP_ToBool(plugin_decryption_interface_->GenerateKeyRequest( |
1340 pp_instance(), | 1356 pp_instance(), |
1341 StringVar::StringToPPVar(key_system), | 1357 StringVar::StringToPPVar(key_system), |
1342 init_data_resource)); | 1358 init_data_resource)); |
1343 } | 1359 } |
1344 | 1360 |
1345 bool PluginInstance::AddKey(const std::string& session_id, | 1361 bool PluginInstance::AddKey(const std::string& session_id, |
1346 const std::string& key) { | 1362 const std::string& key) { |
1347 if (!LoadContentDecryptionModuleInterface()) | 1363 if (!LoadContentDecryptionModuleInterface()) |
1348 return false; | 1364 return false; |
1349 | 1365 |
1350 StringVar session_id_var(session_id); | 1366 StringVar session_id_var(session_id); |
1351 if (session_id_var.value().size() < session_id.size()) | 1367 if (session_id_var.value().size() < session_id.size()) |
1352 return false; | 1368 return false; |
1353 | 1369 |
1354 ScopedPPResource key_resource(ScopedPPResource::PassRef(), | 1370 ScopedPPResource key_resource(ScopedPPResource::PassRef(), |
1355 MakeBufferResource(pp_instance(), key)); | 1371 MakeBufferResource(pp_instance(), |
| 1372 key.data(), |
| 1373 key.size())); |
1356 if (!key_resource.get()) | 1374 if (!key_resource.get()) |
1357 return false; | 1375 return false; |
1358 | 1376 |
1359 return PP_ToBool(plugin_decryption_interface_->AddKey( | 1377 return PP_ToBool(plugin_decryption_interface_->AddKey( |
1360 pp_instance(), | 1378 pp_instance(), |
1361 session_id_var.GetPPVar(), | 1379 session_id_var.GetPPVar(), |
1362 key_resource)); | 1380 key_resource)); |
1363 } | 1381 } |
1364 | 1382 |
1365 bool PluginInstance::CancelKeyRequest(const std::string& session_id) { | 1383 bool PluginInstance::CancelKeyRequest(const std::string& session_id) { |
1366 if (!LoadContentDecryptionModuleInterface()) | 1384 if (!LoadContentDecryptionModuleInterface()) |
1367 return false; | 1385 return false; |
1368 StringVar session_id_var(session_id); | 1386 StringVar session_id_var(session_id); |
1369 if (session_id_var.value().size() < session_id.size()) | 1387 if (session_id_var.value().size() < session_id.size()) |
1370 return false; | 1388 return false; |
1371 return PP_ToBool(plugin_decryption_interface_->CancelKeyRequest( | 1389 return PP_ToBool(plugin_decryption_interface_->CancelKeyRequest( |
1372 pp_instance(), | 1390 pp_instance(), |
1373 session_id_var.GetPPVar())); | 1391 session_id_var.GetPPVar())); |
1374 } | 1392 } |
1375 | 1393 |
1376 bool PluginInstance::Decrypt(const std::string& encrypted_block, | 1394 bool PluginInstance::Decrypt( |
1377 const CDMStatusCB& callback) { | 1395 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
| 1396 const CDMStatusCB& callback) { |
1378 if (!LoadContentDecryptionModuleInterface()) | 1397 if (!LoadContentDecryptionModuleInterface()) |
1379 return false; | 1398 return false; |
1380 ScopedPPResource encrypted_resource(ScopedPPResource::PassRef(), | 1399 |
1381 MakeBufferResource(pp_instance(), | 1400 DCHECK(encrypted_buffer->GetDecryptConfig()); |
1382 encrypted_block)); | 1401 DCHECK(encrypted_buffer->GetData()); |
| 1402 DCHECK_GT(encrypted_buffer->GetDataSize(), 0); |
| 1403 ScopedPPResource encrypted_resource( |
| 1404 ScopedPPResource::PassRef(), |
| 1405 MakeBufferResource( |
| 1406 pp_instance(), |
| 1407 reinterpret_cast<const char*>(encrypted_buffer->GetData()), |
| 1408 encrypted_buffer->GetDataSize())); |
| 1409 |
1383 if (!encrypted_resource.get()) | 1410 if (!encrypted_resource.get()) |
1384 return false; | 1411 return false; |
1385 // TODO(tomfinegan): wrap callback in PP_CompletionCallback and pass it to | 1412 // TODO(tomfinegan): wrap callback in PP_CompletionCallback and pass it to |
1386 // the plugin. | 1413 // the plugin. |
1387 PP_CompletionCallback pp_callback = {NULL, NULL, 0}; | 1414 |
| 1415 const media::DecryptConfig& decrypt_config = |
| 1416 *encrypted_buffer->GetDecryptConfig(); |
| 1417 |
| 1418 uint64_t buffer_id = next_decryption_buffer_id_++; |
| 1419 DCHECK(!ContainsKey(cdm_status_cb_map_, buffer_id)); |
| 1420 cdm_status_cb_map_.insert(std::make_pair(buffer_id, callback)); |
| 1421 |
| 1422 PP_DecryptionBuffer_Dev buffer; |
| 1423 buffer.data = encrypted_resource; |
| 1424 buffer.data_offset = decrypt_config.data_offset(); |
| 1425 buffer.id = buffer_id; |
| 1426 // TODO(xhwang): Fill all fields here. |
| 1427 |
1388 return PP_ToBool(plugin_decryption_interface_->Decrypt(pp_instance(), | 1428 return PP_ToBool(plugin_decryption_interface_->Decrypt(pp_instance(), |
1389 encrypted_resource, | 1429 &buffer)); |
1390 pp_callback)); | |
1391 } | 1430 } |
1392 | 1431 |
1393 bool PluginInstance::DecryptAndDecode(const std::string& encrypted_block, | 1432 bool PluginInstance::DecryptAndDecode(const std::string& encrypted_block, |
1394 const CDMStatusCB& callback) { | 1433 const CDMStatusCB& callback) { |
1395 if (!LoadContentDecryptionModuleInterface()) | 1434 if (!LoadContentDecryptionModuleInterface()) |
1396 return false; | 1435 return false; |
1397 ScopedPPResource encrypted_resource(ScopedPPResource::PassRef(), | 1436 ScopedPPResource encrypted_resource( |
1398 MakeBufferResource(pp_instance(), | 1437 ScopedPPResource::PassRef(), |
1399 encrypted_block)); | 1438 MakeBufferResource(pp_instance(), |
| 1439 encrypted_block.data(), encrypted_block.size())); |
1400 if (!encrypted_resource.get()) | 1440 if (!encrypted_resource.get()) |
1401 return false; | 1441 return false; |
1402 // TODO(tomfinegan): wrap callback in PP_CompletionCallback and pass it to | 1442 // TODO(tomfinegan): wrap callback in PP_CompletionCallback and pass it to |
1403 // the plugin. | 1443 // the plugin. |
1404 PP_CompletionCallback pp_callback = {NULL, NULL, 0}; | 1444 PP_CompletionCallback pp_callback = {NULL, NULL, 0}; |
1405 return PP_ToBool(plugin_decryption_interface_->DecryptAndDecode( | 1445 return PP_ToBool(plugin_decryption_interface_->DecryptAndDecode( |
1406 pp_instance(), | 1446 pp_instance(), |
1407 encrypted_resource, | 1447 encrypted_resource, |
1408 pp_callback)); | 1448 pp_callback)); |
1409 } | 1449 } |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2006 | 2046 |
2007 PP_Var PluginInstance::GetFontFamilies(PP_Instance instance) { | 2047 PP_Var PluginInstance::GetFontFamilies(PP_Instance instance) { |
2008 // No in-process implementation. | 2048 // No in-process implementation. |
2009 return PP_MakeUndefined(); | 2049 return PP_MakeUndefined(); |
2010 } | 2050 } |
2011 | 2051 |
2012 void PluginInstance::NeedKey(PP_Instance instance, | 2052 void PluginInstance::NeedKey(PP_Instance instance, |
2013 PP_Var key_system_var, | 2053 PP_Var key_system_var, |
2014 PP_Var session_id_var, | 2054 PP_Var session_id_var, |
2015 PP_Resource init_data) { | 2055 PP_Resource init_data) { |
2016 StringVar* key_system_string = StringVar::FromPPVar(key_system_var); | 2056 //StringVar* key_system_string = StringVar::FromPPVar(key_system_var); |
2017 StringVar* session_id_string = StringVar::FromPPVar(session_id_var); | 2057 //StringVar* session_id_string = StringVar::FromPPVar(session_id_var); |
2018 | 2058 |
2019 // TODO(tomfinegan): Where does the call to this method come from? Or, where | 2059 // TODO(tomfinegan): Where does the call to this method come from? Or, where |
2020 // does it go for handling. I need to read more of the EME proposed spec, but | 2060 // does it go for handling. I need to read more of the EME proposed spec, but |
2021 // this is what I understand so far: | 2061 // this is what I understand so far: |
2022 // - JS app sends needkey before anything else when it knows that encrypted | 2062 // - JS app sends needkey before anything else when it knows that encrypted |
2023 // data is going to be streamed to the user agent. | 2063 // data is going to be streamed to the user agent. |
2024 // - OR is the media stack going to see something in the stream that looks | 2064 // - OR is the media stack going to see something in the stream that looks |
2025 // like init data, and then send NeedKey. If this is the case NeedKey | 2065 // like init data, and then send NeedKey. If this is the case NeedKey |
2026 // probably needs to move to the PPP interface. | 2066 // probably needs to move to the PPP interface. |
2027 | 2067 |
2028 HostGlobals::Get()->GetVarTracker()->ReleaseVar(key_system_var); | 2068 HostGlobals::Get()->GetVarTracker()->ReleaseVar(key_system_var); |
2029 HostGlobals::Get()->GetVarTracker()->ReleaseVar(session_id_var); | 2069 HostGlobals::Get()->GetVarTracker()->ReleaseVar(session_id_var); |
2030 } | 2070 } |
2031 | 2071 |
2032 void PluginInstance::KeyAdded(PP_Instance instance, | 2072 void PluginInstance::KeyAdded(PP_Instance instance, |
2033 PP_Var key_system, | 2073 PP_Var key_system, |
2034 PP_Var session_id) { | 2074 PP_Var session_id) { |
| 2075 DCHECK(decryptor_client_); |
| 2076 |
2035 } | 2077 } |
2036 | 2078 |
2037 void PluginInstance::KeyMessage(PP_Instance instance, | 2079 void PluginInstance::KeyMessage(PP_Instance instance, |
2038 PP_Var key_system_var, | 2080 PP_Var key_system_var, |
2039 PP_Var session_id_var, | 2081 PP_Var session_id_var, |
2040 PP_Resource message_resource, | 2082 PP_Resource message_resource, |
2041 PP_Var default_url_var) { | 2083 PP_Var default_url_var) { |
2042 StringVar* key_system_string = StringVar::FromPPVar(key_system_var); | 2084 StringVar* key_system_string = StringVar::FromPPVar(key_system_var); |
2043 StringVar* session_id_string = StringVar::FromPPVar(session_id_var); | 2085 StringVar* session_id_string = StringVar::FromPPVar(session_id_var); |
2044 StringVar* default_url_string = StringVar::FromPPVar(default_url_var); | 2086 StringVar* default_url_string = StringVar::FromPPVar(default_url_var); |
(...skipping 17 matching lines...) Expand all Loading... |
2062 return; | 2104 return; |
2063 } | 2105 } |
2064 | 2106 |
2065 std::string message(reinterpret_cast<char*>(mapper.data()), mapper.size()); | 2107 std::string message(reinterpret_cast<char*>(mapper.data()), mapper.size()); |
2066 if (message.empty()) { | 2108 if (message.empty()) { |
2067 // TODO(tomfinegan): KeyError here? | 2109 // TODO(tomfinegan): KeyError here? |
2068 NOTREACHED(); | 2110 NOTREACHED(); |
2069 return; | 2111 return; |
2070 } | 2112 } |
2071 | 2113 |
| 2114 DCHECK(decryptor_client_); |
| 2115 scoped_array<uint8> message_array(new uint8[message.size()]); |
| 2116 memcpy(message_array.get(), message.data(), message.size()); |
| 2117 |
| 2118 decryptor_client_->KeyMessage(key_system_string->value(), |
| 2119 session_id_string->value(), |
| 2120 message_array.Pass(), |
| 2121 message.size(), |
| 2122 default_url_string->value()); |
| 2123 |
2072 // Release the PP_Vars. | 2124 // Release the PP_Vars. |
2073 HostGlobals::Get()->GetVarTracker()->ReleaseVar(key_system_var); | 2125 HostGlobals::Get()->GetVarTracker()->ReleaseVar(key_system_var); |
2074 HostGlobals::Get()->GetVarTracker()->ReleaseVar(session_id_var); | 2126 HostGlobals::Get()->GetVarTracker()->ReleaseVar(session_id_var); |
2075 HostGlobals::Get()->GetVarTracker()->ReleaseVar(default_url_var); | 2127 HostGlobals::Get()->GetVarTracker()->ReleaseVar(default_url_var); |
2076 | 2128 |
2077 // Release the PP_Resource. | 2129 // Release the PP_Resource. |
2078 // TODO(tomfinegan): Confirm that the buffer is freed. | 2130 // TODO(tomfinegan): Confirm that the buffer is freed. |
2079 HostGlobals::Get()->GetResourceTracker()->ReleaseResource(message_resource); | 2131 HostGlobals::Get()->GetResourceTracker()->ReleaseResource(message_resource); |
2080 } | 2132 } |
2081 | 2133 |
2082 void PluginInstance::KeyError(PP_Instance instance, | 2134 void PluginInstance::KeyError(PP_Instance instance, |
2083 PP_Var key_system_var, | 2135 PP_Var key_system_var, |
2084 PP_Var session_id_var, | 2136 PP_Var session_id_var, |
2085 uint16_t media_error, | 2137 uint16_t media_error, |
2086 uint16_t system_error) { | 2138 uint16_t system_error) { |
2087 StringVar* key_system_string = StringVar::FromPPVar(key_system_var); | 2139 //StringVar* key_system_string = StringVar::FromPPVar(key_system_var); |
2088 StringVar* session_id_string = StringVar::FromPPVar(session_id_var); | 2140 //StringVar* session_id_string = StringVar::FromPPVar(session_id_var); |
2089 | 2141 |
2090 HostGlobals::Get()->GetVarTracker()->ReleaseVar(key_system_var); | 2142 HostGlobals::Get()->GetVarTracker()->ReleaseVar(key_system_var); |
2091 HostGlobals::Get()->GetVarTracker()->ReleaseVar(session_id_var); | 2143 HostGlobals::Get()->GetVarTracker()->ReleaseVar(session_id_var); |
2092 } | 2144 } |
2093 | 2145 |
2094 void PluginInstance::DeliverBlock(PP_Instance instance, | 2146 void PluginInstance::DeliverBlock(PP_Instance instance, |
2095 PP_Resource decrypted_block, | 2147 PP_Resource decrypted_block, |
2096 PP_CompletionCallback callback) { | 2148 uint32_t id) { |
2097 // TODO(tomfinegan): Determine where |decrypted_block| goes, and what | 2149 // TODO(tomfinegan): Determine where |decrypted_block| goes, and what |
2098 // callback actually is (callback will likely be the result of some | 2150 // callback actually is (callback will likely be the result of some |
2099 // base::Bind usage in the media stack. Hash this out with xhwang. | 2151 // base::Bind usage in the media stack. Hash this out with xhwang. |
2100 // | 2152 // |
| 2153 |
| 2154 std::map<uint64_t, CDMStatusCB>::iterator found = cdm_status_cb_map_.find(id); |
| 2155 if (found != cdm_status_cb_map_.end()) { |
| 2156 DVLOG(3) << "DeliverBlock(): Buffer ID " << id << " found, callback fired."; |
| 2157 found->second.Run(NULL, 0); |
| 2158 cdm_status_cb_map_.erase(found); |
| 2159 } |
| 2160 else { |
| 2161 DVLOG(3) << "DeliverBlock(): Buffer ID " << id << " not found."; |
| 2162 NOTREACHED(); |
| 2163 } |
| 2164 |
2101 HostGlobals::Get()->GetResourceTracker()->ReleaseResource(decrypted_block); | 2165 HostGlobals::Get()->GetResourceTracker()->ReleaseResource(decrypted_block); |
2102 } | 2166 } |
2103 | 2167 |
2104 void PluginInstance::DeliverFrame(PP_Instance instance, | 2168 void PluginInstance::DeliverFrame(PP_Instance instance, |
2105 PP_Resource decrypted_frame, | 2169 PP_Resource decrypted_frame, |
2106 PP_CompletionCallback callback) { | 2170 PP_CompletionCallback callback) { |
2107 // Not implemented in v0.1 of the EME/CDM work. | 2171 // Not implemented in v0.1 of the EME/CDM work. |
2108 } | 2172 } |
2109 | 2173 |
2110 void PluginInstance::DeliverSamples(PP_Instance instance, | 2174 void PluginInstance::DeliverSamples(PP_Instance instance, |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 screen_size_for_fullscreen_ = gfx::Size(); | 2547 screen_size_for_fullscreen_ = gfx::Size(); |
2484 WebElement element = container_->element(); | 2548 WebElement element = container_->element(); |
2485 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2549 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2486 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2550 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2487 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2551 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2488 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2552 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2489 } | 2553 } |
2490 | 2554 |
2491 } // namespace ppapi | 2555 } // namespace ppapi |
2492 } // namespace webkit | 2556 } // namespace webkit |
OLD | NEW |