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

Side by Side Diff: webkit/media/crypto/ppapi/cdm_wrapper.cc

Issue 11270057: Add type argument to pepper content decryptor method GenerateKeyRequest(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 <cstring> 5 #include <cstring>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 CdmWrapper(PP_Instance instance, pp::Module* module); 472 CdmWrapper(PP_Instance instance, pp::Module* module);
473 virtual ~CdmWrapper(); 473 virtual ~CdmWrapper();
474 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) { 474 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
475 return true; 475 return true;
476 } 476 }
477 477
478 // PPP_ContentDecryptor_Private methods 478 // PPP_ContentDecryptor_Private methods
479 // Note: Results of calls to these methods must be reported through the 479 // Note: Results of calls to these methods must be reported through the
480 // PPB_ContentDecryptor_Private interface. 480 // PPB_ContentDecryptor_Private interface.
481 virtual void GenerateKeyRequest(const std::string& key_system, 481 virtual void GenerateKeyRequest(const std::string& key_system,
482 const std::string& mime_type,
482 pp::VarArrayBuffer init_data) OVERRIDE; 483 pp::VarArrayBuffer init_data) OVERRIDE;
483 virtual void AddKey(const std::string& session_id, 484 virtual void AddKey(const std::string& session_id,
484 pp::VarArrayBuffer key, 485 pp::VarArrayBuffer key,
485 pp::VarArrayBuffer init_data) OVERRIDE; 486 pp::VarArrayBuffer init_data) OVERRIDE;
486 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE; 487 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE;
487 virtual void Decrypt( 488 virtual void Decrypt(
488 pp::Buffer_Dev encrypted_buffer, 489 pp::Buffer_Dev encrypted_buffer,
489 const PP_EncryptedBlockInfo& encrypted_block_info) OVERRIDE; 490 const PP_EncryptedBlockInfo& encrypted_block_info) OVERRIDE;
490 virtual void InitializeAudioDecoder( 491 virtual void InitializeAudioDecoder(
491 const PP_AudioDecoderConfig& decoder_config, 492 const PP_AudioDecoderConfig& decoder_config,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 cdm_(NULL) { 576 cdm_(NULL) {
576 callback_factory_.Initialize(this); 577 callback_factory_.Initialize(this);
577 } 578 }
578 579
579 CdmWrapper::~CdmWrapper() { 580 CdmWrapper::~CdmWrapper() {
580 if (cdm_) 581 if (cdm_)
581 DestroyCdmInstance(cdm_); 582 DestroyCdmInstance(cdm_);
582 } 583 }
583 584
584 void CdmWrapper::GenerateKeyRequest(const std::string& key_system, 585 void CdmWrapper::GenerateKeyRequest(const std::string& key_system,
586 const std::string& mime_type,
585 pp::VarArrayBuffer init_data) { 587 pp::VarArrayBuffer init_data) {
586 PP_DCHECK(!key_system.empty()); 588 PP_DCHECK(!key_system.empty());
587 589
588 if (!cdm_) { 590 if (!cdm_) {
589 cdm_ = CreateCdmInstance(&allocator_, this); 591 cdm_ = CreateCdmInstance(&allocator_, this);
590 if (!cdm_) 592 if (!cdm_)
591 return; 593 return;
592 } 594 }
593 595
594 LinkedKeyMessage key_request(new KeyMessageImpl()); 596 LinkedKeyMessage key_request(new KeyMessageImpl());
595 cdm::Status status = cdm_->GenerateKeyRequest( 597 cdm::Status status = cdm_->GenerateKeyRequest(
598 mime_type.c_str(),
599 mime_type.length(),
xhwang 2012/10/26 06:19:30 Use data() and size() to be consistent with how we
Tom Finegan 2012/10/26 22:51:33 Done.
596 reinterpret_cast<const uint8_t*>(init_data.Map()), 600 reinterpret_cast<const uint8_t*>(init_data.Map()),
597 init_data.ByteLength(), 601 init_data.ByteLength(),
598 key_request.get()); 602 key_request.get());
599 PP_DCHECK(status == cdm::kSuccess || status == cdm::kSessionError); 603 PP_DCHECK(status == cdm::kSuccess || status == cdm::kSessionError);
600 if (status != cdm::kSuccess || 604 if (status != cdm::kSuccess ||
601 !key_request->message() || 605 !key_request->message() ||
602 key_request->message()->size() == 0) { 606 key_request->message()->size() == 0) {
603 CallOnMain(callback_factory_.NewCallback(&CdmWrapper::KeyError, 607 CallOnMain(callback_factory_.NewCallback(&CdmWrapper::KeyError,
604 std::string())); 608 std::string()));
605 return; 609 return;
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 } // namespace webkit_media 982 } // namespace webkit_media
979 983
980 namespace pp { 984 namespace pp {
981 985
982 // Factory function for your specialization of the Module object. 986 // Factory function for your specialization of the Module object.
983 Module* CreateModule() { 987 Module* CreateModule() {
984 return new webkit_media::CdmWrapperModule(); 988 return new webkit_media::CdmWrapperModule();
985 } 989 }
986 990
987 } // namespace pp 991 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698