Chromium Code Reviews| 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 "content/renderer/pepper/content_decryptor_delegate.h" | 5 #include "content/renderer/pepper/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/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 618 | 618 |
| 619 // TODO(tomfinegan): Need to get stream type from media stack. | 619 // TODO(tomfinegan): Need to get stream type from media stack. |
| 620 ScopedPPResource pp_resource(encrypted_resource.get()); | 620 ScopedPPResource pp_resource(encrypted_resource.get()); |
| 621 plugin_decryption_interface_->DecryptAndDecode( | 621 plugin_decryption_interface_->DecryptAndDecode( |
| 622 pp_instance_, PP_DECRYPTORSTREAMTYPE_VIDEO, pp_resource, &block_info); | 622 pp_instance_, PP_DECRYPTORSTREAMTYPE_VIDEO, pp_resource, &block_info); |
| 623 return true; | 623 return true; |
| 624 } | 624 } |
| 625 | 625 |
| 626 void ContentDecryptorDelegate::OnPromiseResolved(uint32 promise_id) { | 626 void ContentDecryptorDelegate::OnPromiseResolved(uint32 promise_id) { |
| 627 scoped_ptr<CdmPromise> promise = TakePromise(promise_id); | 627 scoped_ptr<CdmPromise> promise = TakePromise(promise_id); |
| 628 if (promise) { | 628 DCHECK(promise && |
| 629 promise->GetResolveParameterType() == media::CdmPromise::VOID_TYPE); | |
| 630 if (promise && | |
| 631 promise->GetResolveParameterType() == media::CdmPromise::VOID_TYPE) { | |
| 629 SimpleCdmPromise* simple_promise( | 632 SimpleCdmPromise* simple_promise( |
| 630 static_cast<SimpleCdmPromise*>(promise.get())); | 633 static_cast<SimpleCdmPromise*>(promise.get())); |
| 631 simple_promise->resolve(); | 634 simple_promise->resolve(); |
| 632 } | 635 } |
|
xhwang
2014/08/27 22:49:26
nit: A simpler version:
if (!promise || promise->
jrummell
2014/08/27 23:05:13
Done.
| |
| 633 } | 636 } |
| 634 | 637 |
| 635 void ContentDecryptorDelegate::OnPromiseResolvedWithSession( | 638 void ContentDecryptorDelegate::OnPromiseResolvedWithSession( |
| 636 uint32 promise_id, | 639 uint32 promise_id, |
| 637 PP_Var web_session_id) { | 640 PP_Var web_session_id) { |
| 638 scoped_ptr<CdmPromise> promise = TakePromise(promise_id); | 641 scoped_ptr<CdmPromise> promise = TakePromise(promise_id); |
| 639 | 642 |
| 640 StringVar* web_session_id_string = StringVar::FromPPVar(web_session_id); | 643 StringVar* web_session_id_string = StringVar::FromPPVar(web_session_id); |
| 641 DCHECK(web_session_id_string); | 644 DCHECK(web_session_id_string); |
| 642 | 645 |
| 643 if (promise) { | 646 DCHECK(promise && |
| 647 promise->GetResolveParameterType() == media::CdmPromise::STRING_TYPE); | |
| 648 if (promise && | |
| 649 promise->GetResolveParameterType() == media::CdmPromise::STRING_TYPE) { | |
|
xhwang
2014/08/27 22:49:26
ditto
jrummell
2014/08/27 23:05:13
Done.
| |
| 644 NewSessionCdmPromise* session_promise( | 650 NewSessionCdmPromise* session_promise( |
| 645 static_cast<NewSessionCdmPromise*>(promise.get())); | 651 static_cast<NewSessionCdmPromise*>(promise.get())); |
| 646 session_promise->resolve(web_session_id_string->value()); | 652 session_promise->resolve(web_session_id_string->value()); |
| 647 } | 653 } |
| 648 } | 654 } |
| 649 | 655 |
| 650 void ContentDecryptorDelegate::OnPromiseRejected( | 656 void ContentDecryptorDelegate::OnPromiseRejected( |
| 651 uint32 promise_id, | 657 uint32 promise_id, |
| 652 PP_CdmExceptionCode exception_code, | 658 PP_CdmExceptionCode exception_code, |
| 653 uint32 system_code, | 659 uint32 system_code, |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1174 | 1180 |
| 1175 scoped_ptr<CdmPromise> ContentDecryptorDelegate::TakePromise( | 1181 scoped_ptr<CdmPromise> ContentDecryptorDelegate::TakePromise( |
| 1176 uint32_t promise_id) { | 1182 uint32_t promise_id) { |
| 1177 PromiseMap::iterator it = promises_.find(promise_id); | 1183 PromiseMap::iterator it = promises_.find(promise_id); |
| 1178 if (it == promises_.end()) | 1184 if (it == promises_.end()) |
| 1179 return scoped_ptr<CdmPromise>(); | 1185 return scoped_ptr<CdmPromise>(); |
| 1180 return promises_.take_and_erase(it); | 1186 return promises_.take_and_erase(it); |
| 1181 } | 1187 } |
| 1182 | 1188 |
| 1183 } // namespace content | 1189 } // namespace content |
| OLD | NEW |