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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 const std::string& init_data) { | 1457 const std::string& init_data) { |
1458 if (!LoadContentDecryptorInterface()) | 1458 if (!LoadContentDecryptorInterface()) |
1459 return false; | 1459 return false; |
1460 if (key_system.empty()) | 1460 if (key_system.empty()) |
1461 return false; | 1461 return false; |
1462 | 1462 |
1463 PP_Var init_data_array = | 1463 PP_Var init_data_array = |
1464 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( | 1464 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( |
1465 init_data.size(), init_data.data()); | 1465 init_data.size(), init_data.data()); |
1466 | 1466 |
1467 return PP_ToBool(plugin_decryption_interface_->GenerateKeyRequest( | 1467 plugin_decryption_interface_->GenerateKeyRequest( |
1468 pp_instance(), | 1468 pp_instance(), |
1469 StringVar::StringToPPVar(key_system), | 1469 StringVar::StringToPPVar(key_system), |
1470 init_data_array)); | 1470 init_data_array); |
| 1471 return true; |
1471 } | 1472 } |
1472 | 1473 |
1473 bool PluginInstance::AddKey(const std::string& session_id, | 1474 bool PluginInstance::AddKey(const std::string& session_id, |
1474 const std::string& key, | 1475 const std::string& key, |
1475 const std::string& init_data) { | 1476 const std::string& init_data) { |
1476 if (!LoadContentDecryptorInterface()) | 1477 if (!LoadContentDecryptorInterface()) |
1477 return false; | 1478 return false; |
1478 PP_Var key_array = | 1479 PP_Var key_array = |
1479 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(key.size(), | 1480 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(key.size(), |
1480 key.data()); | 1481 key.data()); |
1481 PP_Var init_data_array = | 1482 PP_Var init_data_array = |
1482 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( | 1483 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( |
1483 init_data.size(), | 1484 init_data.size(), |
1484 init_data.data()); | 1485 init_data.data()); |
1485 | 1486 |
1486 return PP_ToBool(plugin_decryption_interface_->AddKey( | 1487 plugin_decryption_interface_->AddKey( |
1487 pp_instance(), | 1488 pp_instance(), |
1488 StringVar::StringToPPVar(session_id), | 1489 StringVar::StringToPPVar(session_id), |
1489 key_array, | 1490 key_array, |
1490 init_data_array)); | 1491 init_data_array); |
| 1492 return true; |
1491 } | 1493 } |
1492 | 1494 |
1493 bool PluginInstance::CancelKeyRequest(const std::string& session_id) { | 1495 bool PluginInstance::CancelKeyRequest(const std::string& session_id) { |
1494 if (!LoadContentDecryptorInterface()) | 1496 if (!LoadContentDecryptorInterface()) |
1495 return false; | 1497 return false; |
1496 | 1498 plugin_decryption_interface_->CancelKeyRequest( |
1497 return PP_ToBool(plugin_decryption_interface_->CancelKeyRequest( | |
1498 pp_instance(), | 1499 pp_instance(), |
1499 StringVar::StringToPPVar(session_id))); | 1500 StringVar::StringToPPVar(session_id)); |
| 1501 return true; |
1500 } | 1502 } |
1501 | 1503 |
1502 bool PluginInstance::Decrypt( | 1504 bool PluginInstance::Decrypt( |
1503 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 1505 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
1504 const media::Decryptor::DecryptCB& decrypt_cb) { | 1506 const media::Decryptor::DecryptCB& decrypt_cb) { |
1505 if (!LoadContentDecryptorInterface()) | 1507 if (!LoadContentDecryptorInterface()) |
1506 return false; | 1508 return false; |
1507 | 1509 |
1508 ScopedPPResource encrypted_resource( | 1510 ScopedPPResource encrypted_resource( |
1509 ScopedPPResource::PassRef(), | 1511 ScopedPPResource::PassRef(), |
(...skipping 10 matching lines...) Expand all Loading... |
1520 if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(), | 1522 if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(), |
1521 encrypted_buffer->GetTimestamp().InMicroseconds(), | 1523 encrypted_buffer->GetTimestamp().InMicroseconds(), |
1522 request_id, | 1524 request_id, |
1523 &block_info)) { | 1525 &block_info)) { |
1524 return false; | 1526 return false; |
1525 } | 1527 } |
1526 | 1528 |
1527 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); | 1529 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); |
1528 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); | 1530 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); |
1529 | 1531 |
1530 return PP_ToBool(plugin_decryption_interface_->Decrypt(pp_instance(), | 1532 plugin_decryption_interface_->Decrypt(pp_instance(), |
1531 encrypted_resource, | 1533 encrypted_resource, |
1532 &block_info)); | 1534 &block_info); |
| 1535 return true; |
1533 } | 1536 } |
1534 | 1537 |
1535 bool PluginInstance::DecryptAndDecode( | 1538 bool PluginInstance::DecryptAndDecode( |
1536 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, | 1539 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
1537 const media::Decryptor::DecryptCB& decrypt_cb) { | 1540 const media::Decryptor::DecryptCB& decrypt_cb) { |
1538 if (!LoadContentDecryptorInterface()) | 1541 if (!LoadContentDecryptorInterface()) |
1539 return false; | 1542 return false; |
1540 | 1543 |
1541 ScopedPPResource encrypted_resource(MakeBufferResource( | 1544 ScopedPPResource encrypted_resource(MakeBufferResource( |
1542 pp_instance(), | 1545 pp_instance(), |
1543 encrypted_buffer->GetData(), | 1546 encrypted_buffer->GetData(), |
1544 encrypted_buffer->GetDataSize())); | 1547 encrypted_buffer->GetDataSize())); |
1545 if (!encrypted_resource.get()) | 1548 if (!encrypted_resource.get()) |
1546 return false; | 1549 return false; |
1547 | 1550 |
1548 PP_EncryptedBlockInfo block_info; | 1551 PP_EncryptedBlockInfo block_info; |
1549 | 1552 |
1550 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor. | 1553 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor. |
1551 return PP_ToBool( | 1554 plugin_decryption_interface_->DecryptAndDecode(pp_instance(), |
1552 plugin_decryption_interface_->DecryptAndDecode(pp_instance(), | 1555 encrypted_resource, |
1553 encrypted_resource, | 1556 &block_info); |
1554 &block_info)); | 1557 return true; |
1555 } | 1558 } |
1556 | 1559 |
1557 bool PluginInstance::FlashIsFullscreenOrPending() { | 1560 bool PluginInstance::FlashIsFullscreenOrPending() { |
1558 return fullscreen_container_ != NULL; | 1561 return fullscreen_container_ != NULL; |
1559 } | 1562 } |
1560 | 1563 |
1561 bool PluginInstance::IsFullscreenOrPending() { | 1564 bool PluginInstance::IsFullscreenOrPending() { |
1562 return desired_fullscreen_state_; | 1565 return desired_fullscreen_state_; |
1563 } | 1566 } |
1564 | 1567 |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2665 screen_size_for_fullscreen_ = gfx::Size(); | 2668 screen_size_for_fullscreen_ = gfx::Size(); |
2666 WebElement element = container_->element(); | 2669 WebElement element = container_->element(); |
2667 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2670 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2668 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2671 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2669 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2672 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2670 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2673 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2671 } | 2674 } |
2672 | 2675 |
2673 } // namespace ppapi | 2676 } // namespace ppapi |
2674 } // namespace webkit | 2677 } // namespace webkit |
OLD | NEW |