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

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: 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
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 plugin_pdf_interface_->Transform(pp_instance(), transform_type); 1446 plugin_pdf_interface_->Transform(pp_instance(), transform_type);
1447 // NOTE: plugin instance may have been deleted. 1447 // NOTE: plugin instance may have been deleted.
1448 } 1448 }
1449 1449
1450 void PluginInstance::set_decrypt_client( 1450 void PluginInstance::set_decrypt_client(
1451 media::DecryptorClient* decryptor_client) { 1451 media::DecryptorClient* decryptor_client) {
1452 DCHECK(decryptor_client); 1452 DCHECK(decryptor_client);
1453 decryptor_client_ = decryptor_client; 1453 decryptor_client_ = decryptor_client;
1454 } 1454 }
1455 1455
1456 bool PluginInstance::GenerateKeyRequest(const std::string& key_system, 1456 void PluginInstance::GenerateKeyRequest(const std::string& key_system,
1457 const std::string& init_data) { 1457 const std::string& init_data) {
1458 if (!LoadContentDecryptorInterface()) 1458 if (!LoadContentDecryptorInterface())
1459 return false; 1459 return;
1460 if (key_system.empty()) 1460 if (key_system.empty())
1461 return false; 1461 return;
dmichael (off chromium) 2012/09/11 15:59:17 At this level, I think it's up to you guys what yo
Tom Finegan 2012/09/11 16:49:24 Done.
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 } 1471 }
1472 1472
1473 bool PluginInstance::AddKey(const std::string& session_id, 1473 void PluginInstance::AddKey(const std::string& session_id,
1474 const std::string& key, 1474 const std::string& key,
1475 const std::string& init_data) { 1475 const std::string& init_data) {
1476 if (!LoadContentDecryptorInterface()) 1476 if (!LoadContentDecryptorInterface())
1477 return false; 1477 return;
1478 PP_Var key_array = 1478 PP_Var key_array =
1479 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(key.size(), 1479 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(key.size(),
1480 key.data()); 1480 key.data());
1481 PP_Var init_data_array = 1481 PP_Var init_data_array =
1482 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( 1482 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
1483 init_data.size(), 1483 init_data.size(),
1484 init_data.data()); 1484 init_data.data());
1485 1485
1486 return PP_ToBool(plugin_decryption_interface_->AddKey( 1486 plugin_decryption_interface_->AddKey(
1487 pp_instance(), 1487 pp_instance(),
1488 StringVar::StringToPPVar(session_id), 1488 StringVar::StringToPPVar(session_id),
1489 key_array, 1489 key_array,
1490 init_data_array)); 1490 init_data_array);
1491 } 1491 }
1492 1492
1493 bool PluginInstance::CancelKeyRequest(const std::string& session_id) { 1493 void PluginInstance::CancelKeyRequest(const std::string& session_id) {
1494 if (!LoadContentDecryptorInterface()) 1494 if (!LoadContentDecryptorInterface())
1495 return false; 1495 return;
1496 1496
1497 return PP_ToBool(plugin_decryption_interface_->CancelKeyRequest( 1497 plugin_decryption_interface_->CancelKeyRequest(
1498 pp_instance(), 1498 pp_instance(),
1499 StringVar::StringToPPVar(session_id))); 1499 StringVar::StringToPPVar(session_id));
1500 } 1500 }
1501 1501
1502 bool PluginInstance::Decrypt( 1502 void PluginInstance::Decrypt(
1503 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, 1503 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
1504 const media::Decryptor::DecryptCB& decrypt_cb) { 1504 const media::Decryptor::DecryptCB& decrypt_cb) {
1505 if (!LoadContentDecryptorInterface()) 1505 if (!LoadContentDecryptorInterface())
1506 return false; 1506 return;
1507 1507
1508 ScopedPPResource encrypted_resource( 1508 ScopedPPResource encrypted_resource(
1509 ScopedPPResource::PassRef(), 1509 ScopedPPResource::PassRef(),
1510 MakeBufferResource(pp_instance(), 1510 MakeBufferResource(pp_instance(),
1511 encrypted_buffer->GetData(), 1511 encrypted_buffer->GetData(),
1512 encrypted_buffer->GetDataSize())); 1512 encrypted_buffer->GetDataSize()));
1513 if (!encrypted_resource.get()) 1513 if (!encrypted_resource.get())
1514 return false; 1514 return;
1515 1515
1516 uint32_t request_id = next_decryption_request_id_++; 1516 uint32_t request_id = next_decryption_request_id_++;
1517 1517
1518 PP_EncryptedBlockInfo block_info; 1518 PP_EncryptedBlockInfo block_info;
1519 DCHECK(encrypted_buffer->GetDecryptConfig()); 1519 DCHECK(encrypted_buffer->GetDecryptConfig());
1520 if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(), 1520 if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(),
1521 encrypted_buffer->GetTimestamp().InMicroseconds(), 1521 encrypted_buffer->GetTimestamp().InMicroseconds(),
1522 request_id, 1522 request_id,
1523 &block_info)) { 1523 &block_info)) {
1524 return false; 1524 return;
1525 } 1525 }
1526 1526
1527 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); 1527 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id));
1528 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); 1528 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb));
1529 1529
1530 return PP_ToBool(plugin_decryption_interface_->Decrypt(pp_instance(), 1530 plugin_decryption_interface_->Decrypt(pp_instance(),
1531 encrypted_resource, 1531 encrypted_resource,
1532 &block_info)); 1532 &block_info);
1533 } 1533 }
1534 1534
1535 bool PluginInstance::DecryptAndDecode( 1535 void PluginInstance::DecryptAndDecode(
1536 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, 1536 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
1537 const media::Decryptor::DecryptCB& decrypt_cb) { 1537 const media::Decryptor::DecryptCB& decrypt_cb) {
1538 if (!LoadContentDecryptorInterface()) 1538 if (!LoadContentDecryptorInterface())
1539 return false; 1539 return;
1540 1540
1541 ScopedPPResource encrypted_resource(MakeBufferResource( 1541 ScopedPPResource encrypted_resource(MakeBufferResource(
1542 pp_instance(), 1542 pp_instance(),
1543 encrypted_buffer->GetData(), 1543 encrypted_buffer->GetData(),
1544 encrypted_buffer->GetDataSize())); 1544 encrypted_buffer->GetDataSize()));
1545 if (!encrypted_resource.get()) 1545 if (!encrypted_resource.get())
1546 return false; 1546 return;
1547 1547
1548 PP_EncryptedBlockInfo block_info; 1548 PP_EncryptedBlockInfo block_info;
1549 1549
1550 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor. 1550 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor.
1551 return PP_ToBool( 1551 plugin_decryption_interface_->DecryptAndDecode(pp_instance(),
1552 plugin_decryption_interface_->DecryptAndDecode(pp_instance(), 1552 encrypted_resource,
1553 encrypted_resource, 1553 &block_info);
1554 &block_info));
1555 } 1554 }
1556 1555
1557 bool PluginInstance::FlashIsFullscreenOrPending() { 1556 bool PluginInstance::FlashIsFullscreenOrPending() {
1558 return fullscreen_container_ != NULL; 1557 return fullscreen_container_ != NULL;
1559 } 1558 }
1560 1559
1561 bool PluginInstance::IsFullscreenOrPending() { 1560 bool PluginInstance::IsFullscreenOrPending() {
1562 return desired_fullscreen_state_; 1561 return desired_fullscreen_state_;
1563 } 1562 }
1564 1563
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2665 screen_size_for_fullscreen_ = gfx::Size(); 2664 screen_size_for_fullscreen_ = gfx::Size();
2666 WebElement element = container_->element(); 2665 WebElement element = container_->element();
2667 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2666 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2668 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2667 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2669 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2668 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2670 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2669 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2671 } 2670 }
2672 2671
2673 } // namespace ppapi 2672 } // namespace ppapi
2674 } // namespace webkit 2673 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698