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

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

Issue 15772012: Separate MediaKeys interface from Decryptor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android Created 7 years, 6 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/content_decryptor_delegate.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/content_decryptor_delegate.h" 5 #include "webkit/plugins/ppapi/content_decryptor_delegate.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "media/base/audio_decoder_config.h" 10 #include "media/base/audio_decoder_config.h"
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 621
622 void ContentDecryptorDelegate::KeyAdded(PP_Var key_system_var, 622 void ContentDecryptorDelegate::KeyAdded(PP_Var key_system_var,
623 PP_Var session_id_var) { 623 PP_Var session_id_var) {
624 if (key_added_cb_.is_null()) 624 if (key_added_cb_.is_null())
625 return; 625 return;
626 626
627 StringVar* key_system_string = StringVar::FromPPVar(key_system_var); 627 StringVar* key_system_string = StringVar::FromPPVar(key_system_var);
628 StringVar* session_id_string = StringVar::FromPPVar(session_id_var); 628 StringVar* session_id_string = StringVar::FromPPVar(session_id_var);
629 if (!key_system_string || !session_id_string) { 629 if (!key_system_string || !session_id_string) {
630 key_error_cb_.Run( 630 key_error_cb_.Run(
631 std::string(), std::string(), media::Decryptor::kUnknownError, 0); 631 std::string(), std::string(), media::MediaKeys::kUnknownError, 0);
632 return; 632 return;
633 } 633 }
634 634
635 key_added_cb_.Run(key_system_string->value(), session_id_string->value()); 635 key_added_cb_.Run(key_system_string->value(), session_id_string->value());
636 } 636 }
637 637
638 void ContentDecryptorDelegate::KeyMessage(PP_Var key_system_var, 638 void ContentDecryptorDelegate::KeyMessage(PP_Var key_system_var,
639 PP_Var session_id_var, 639 PP_Var session_id_var,
640 PP_Var message_var, 640 PP_Var message_var,
641 PP_Var default_url_var) { 641 PP_Var default_url_var) {
642 if (key_message_cb_.is_null()) 642 if (key_message_cb_.is_null())
643 return; 643 return;
644 644
645 StringVar* key_system_string = StringVar::FromPPVar(key_system_var); 645 StringVar* key_system_string = StringVar::FromPPVar(key_system_var);
646 StringVar* session_id_string = StringVar::FromPPVar(session_id_var); 646 StringVar* session_id_string = StringVar::FromPPVar(session_id_var);
647 647
648 ArrayBufferVar* message_array_buffer = 648 ArrayBufferVar* message_array_buffer =
649 ArrayBufferVar::FromPPVar(message_var); 649 ArrayBufferVar::FromPPVar(message_var);
650 650
651 std::string message; 651 std::string message;
652 if (message_array_buffer) { 652 if (message_array_buffer) {
653 const char* data = static_cast<const char*>(message_array_buffer->Map()); 653 const char* data = static_cast<const char*>(message_array_buffer->Map());
654 message.assign(data, message_array_buffer->ByteLength()); 654 message.assign(data, message_array_buffer->ByteLength());
655 } 655 }
656 656
657 StringVar* default_url_string = StringVar::FromPPVar(default_url_var); 657 StringVar* default_url_string = StringVar::FromPPVar(default_url_var);
658 658
659 if (!key_system_string || !session_id_string || !default_url_string) { 659 if (!key_system_string || !session_id_string || !default_url_string) {
660 key_error_cb_.Run( 660 key_error_cb_.Run(
661 std::string(), std::string(), media::Decryptor::kUnknownError, 0); 661 std::string(), std::string(), media::MediaKeys::kUnknownError, 0);
662 return; 662 return;
663 } 663 }
664 664
665 key_message_cb_.Run(key_system_string->value(), 665 key_message_cb_.Run(key_system_string->value(),
666 session_id_string->value(), 666 session_id_string->value(),
667 message, 667 message,
668 default_url_string->value()); 668 default_url_string->value());
669 } 669 }
670 670
671 void ContentDecryptorDelegate::KeyError(PP_Var key_system_var, 671 void ContentDecryptorDelegate::KeyError(PP_Var key_system_var,
672 PP_Var session_id_var, 672 PP_Var session_id_var,
673 int32_t media_error, 673 int32_t media_error,
674 int32_t system_code) { 674 int32_t system_code) {
675 if (key_error_cb_.is_null()) 675 if (key_error_cb_.is_null())
676 return; 676 return;
677 677
678 StringVar* key_system_string = StringVar::FromPPVar(key_system_var); 678 StringVar* key_system_string = StringVar::FromPPVar(key_system_var);
679 StringVar* session_id_string = StringVar::FromPPVar(session_id_var); 679 StringVar* session_id_string = StringVar::FromPPVar(session_id_var);
680 if (!key_system_string || !session_id_string) { 680 if (!key_system_string || !session_id_string) {
681 key_error_cb_.Run( 681 key_error_cb_.Run(
682 std::string(), std::string(), media::Decryptor::kUnknownError, 0); 682 std::string(), std::string(), media::MediaKeys::kUnknownError, 0);
683 return; 683 return;
684 } 684 }
685 685
686 key_error_cb_.Run( 686 key_error_cb_.Run(
687 key_system_string->value(), 687 key_system_string->value(),
688 session_id_string->value(), 688 session_id_string->value(),
689 static_cast<media::Decryptor::KeyError>(media_error), 689 static_cast<media::MediaKeys::KeyError>(media_error),
690 system_code); 690 system_code);
691 } 691 }
692 692
693 void ContentDecryptorDelegate::DecoderInitializeDone( 693 void ContentDecryptorDelegate::DecoderInitializeDone(
694 PP_DecryptorStreamType decoder_type, 694 PP_DecryptorStreamType decoder_type,
695 uint32_t request_id, 695 uint32_t request_id,
696 PP_Bool success) { 696 PP_Bool success) {
697 if (decoder_type == PP_DECRYPTORSTREAMTYPE_AUDIO) { 697 if (decoder_type == PP_DECRYPTORSTREAMTYPE_AUDIO) {
698 // If the request ID is not valid or does not match what's saved, do 698 // If the request ID is not valid or does not match what's saved, do
699 // nothing. 699 // nothing.
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 1025
1026 if (free_buffers_.empty()) 1026 if (free_buffers_.empty())
1027 return; 1027 return;
1028 1028
1029 tracking_info->buffer_id = free_buffers_.front(); 1029 tracking_info->buffer_id = free_buffers_.front();
1030 free_buffers_.pop(); 1030 free_buffers_.pop();
1031 } 1031 }
1032 1032
1033 } // namespace ppapi 1033 } // namespace ppapi
1034 } // namespace webkit 1034 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/content_decryptor_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698