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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 10928098: Return void from all PPP CDM API interface methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
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 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 const std::string& init_data) { 1459 const std::string& init_data) {
1460 if (!LoadContentDecryptorInterface()) 1460 if (!LoadContentDecryptorInterface())
1461 return false; 1461 return false;
1462 if (key_system.empty()) 1462 if (key_system.empty())
1463 return false; 1463 return false;
1464 1464
1465 PP_Var init_data_array = 1465 PP_Var init_data_array =
1466 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( 1466 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
1467 init_data.size(), init_data.data()); 1467 init_data.size(), init_data.data());
1468 1468
1469 return PP_ToBool(plugin_decryption_interface_->GenerateKeyRequest( 1469 plugin_decryption_interface_->GenerateKeyRequest(
1470 pp_instance(), 1470 pp_instance(),
1471 StringVar::StringToPPVar(key_system), 1471 StringVar::StringToPPVar(key_system),
1472 init_data_array)); 1472 init_data_array);
1473 return true;
1473 } 1474 }
1474 1475
1475 bool PluginInstance::AddKey(const std::string& session_id, 1476 bool PluginInstance::AddKey(const std::string& session_id,
1476 const std::string& key, 1477 const std::string& key,
1477 const std::string& init_data) { 1478 const std::string& init_data) {
1478 if (!LoadContentDecryptorInterface()) 1479 if (!LoadContentDecryptorInterface())
1479 return false; 1480 return false;
1480 PP_Var key_array = 1481 PP_Var key_array =
1481 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(key.size(), 1482 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(key.size(),
1482 key.data()); 1483 key.data());
1483 PP_Var init_data_array = 1484 PP_Var init_data_array =
1484 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( 1485 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
1485 init_data.size(), 1486 init_data.size(),
1486 init_data.data()); 1487 init_data.data());
1487 1488
1488 return PP_ToBool(plugin_decryption_interface_->AddKey( 1489 plugin_decryption_interface_->AddKey(
1489 pp_instance(), 1490 pp_instance(),
1490 StringVar::StringToPPVar(session_id), 1491 StringVar::StringToPPVar(session_id),
1491 key_array, 1492 key_array,
1492 init_data_array)); 1493 init_data_array);
1494 return true;
1493 } 1495 }
1494 1496
1495 bool PluginInstance::CancelKeyRequest(const std::string& session_id) { 1497 bool PluginInstance::CancelKeyRequest(const std::string& session_id) {
1496 if (!LoadContentDecryptorInterface()) 1498 if (!LoadContentDecryptorInterface())
1497 return false; 1499 return false;
1498 1500 plugin_decryption_interface_->CancelKeyRequest(
1499 return PP_ToBool(plugin_decryption_interface_->CancelKeyRequest(
1500 pp_instance(), 1501 pp_instance(),
1501 StringVar::StringToPPVar(session_id))); 1502 StringVar::StringToPPVar(session_id));
1503 return true;
1502 } 1504 }
1503 1505
1504 bool PluginInstance::Decrypt( 1506 bool PluginInstance::Decrypt(
1505 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, 1507 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
1506 const media::Decryptor::DecryptCB& decrypt_cb) { 1508 const media::Decryptor::DecryptCB& decrypt_cb) {
1507 if (!LoadContentDecryptorInterface()) 1509 if (!LoadContentDecryptorInterface())
1508 return false; 1510 return false;
1509 1511
1510 ScopedPPResource encrypted_resource( 1512 ScopedPPResource encrypted_resource(
1511 ScopedPPResource::PassRef(), 1513 ScopedPPResource::PassRef(),
(...skipping 10 matching lines...) Expand all
1522 if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(), 1524 if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(),
1523 encrypted_buffer->GetTimestamp().InMicroseconds(), 1525 encrypted_buffer->GetTimestamp().InMicroseconds(),
1524 request_id, 1526 request_id,
1525 &block_info)) { 1527 &block_info)) {
1526 return false; 1528 return false;
1527 } 1529 }
1528 1530
1529 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); 1531 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id));
1530 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); 1532 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb));
1531 1533
1532 return PP_ToBool(plugin_decryption_interface_->Decrypt(pp_instance(), 1534 plugin_decryption_interface_->Decrypt(pp_instance(),
1533 encrypted_resource, 1535 encrypted_resource,
1534 &block_info)); 1536 &block_info);
1537 return true;
1535 } 1538 }
1536 1539
1537 bool PluginInstance::DecryptAndDecode( 1540 bool PluginInstance::DecryptAndDecode(
1538 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, 1541 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
1539 const media::Decryptor::DecryptCB& decrypt_cb) { 1542 const media::Decryptor::DecryptCB& decrypt_cb) {
1540 if (!LoadContentDecryptorInterface()) 1543 if (!LoadContentDecryptorInterface())
1541 return false; 1544 return false;
1542 1545
1543 ScopedPPResource encrypted_resource(MakeBufferResource( 1546 ScopedPPResource encrypted_resource(MakeBufferResource(
1544 pp_instance(), 1547 pp_instance(),
1545 encrypted_buffer->GetData(), 1548 encrypted_buffer->GetData(),
1546 encrypted_buffer->GetDataSize())); 1549 encrypted_buffer->GetDataSize()));
1547 if (!encrypted_resource.get()) 1550 if (!encrypted_resource.get())
1548 return false; 1551 return false;
1549 1552
1550 PP_EncryptedBlockInfo block_info; 1553 PP_EncryptedBlockInfo block_info;
1551 1554
1552 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor. 1555 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor.
1553 return PP_ToBool( 1556 plugin_decryption_interface_->DecryptAndDecode(pp_instance(),
1554 plugin_decryption_interface_->DecryptAndDecode(pp_instance(), 1557 encrypted_resource,
1555 encrypted_resource, 1558 &block_info);
1556 &block_info)); 1559 return true;
1557 } 1560 }
1558 1561
1559 bool PluginInstance::FlashIsFullscreenOrPending() { 1562 bool PluginInstance::FlashIsFullscreenOrPending() {
1560 return fullscreen_container_ != NULL; 1563 return fullscreen_container_ != NULL;
1561 } 1564 }
1562 1565
1563 bool PluginInstance::IsFullscreenOrPending() { 1566 bool PluginInstance::IsFullscreenOrPending() {
1564 return desired_fullscreen_state_; 1567 return desired_fullscreen_state_;
1565 } 1568 }
1566 1569
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 screen_size_for_fullscreen_ = gfx::Size(); 2663 screen_size_for_fullscreen_ = gfx::Size();
2661 WebElement element = container_->element(); 2664 WebElement element = container_->element();
2662 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2665 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2663 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2666 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2664 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2667 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2665 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2668 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2666 } 2669 }
2667 2670
2668 } // namespace ppapi 2671 } // namespace ppapi
2669 } // namespace webkit 2672 } // namespace webkit
OLDNEW
« webkit/media/crypto/ppapi/cdm_wrapper.cc ('K') | « webkit/media/crypto/ppapi/cdm_wrapper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698