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 | |
629 // Special case due to http://crbug.com/408330. CDM is resolving LoadSession() | |
630 // with this method when the session is not found. Instead it should call | |
631 // PromiseResolvedWithSession(""), so emulate that here until 408330 is fixed. | |
xhwang
2014/08/28 20:33:51
nit: add a TODO so that we don't forget to remove
jrummell
2014/08/28 21:26:27
Done.
| |
632 if (promise && | |
633 promise->GetResolveParameterType() == media::CdmPromise::STRING_TYPE) { | |
634 NewSessionCdmPromise* session_promise( | |
635 static_cast<NewSessionCdmPromise*>(promise.get())); | |
636 session_promise->resolve(std::string()); | |
637 return; | |
638 } | |
639 | |
628 if (!promise || | 640 if (!promise || |
629 promise->GetResolveParameterType() != media::CdmPromise::VOID_TYPE) { | 641 promise->GetResolveParameterType() != media::CdmPromise::VOID_TYPE) { |
630 NOTREACHED(); | 642 NOTREACHED(); |
631 return; | 643 return; |
632 } | 644 } |
633 | 645 |
634 SimpleCdmPromise* simple_promise( | 646 SimpleCdmPromise* simple_promise( |
635 static_cast<SimpleCdmPromise*>(promise.get())); | 647 static_cast<SimpleCdmPromise*>(promise.get())); |
636 simple_promise->resolve(); | 648 simple_promise->resolve(); |
637 } | 649 } |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1181 | 1193 |
1182 scoped_ptr<CdmPromise> ContentDecryptorDelegate::TakePromise( | 1194 scoped_ptr<CdmPromise> ContentDecryptorDelegate::TakePromise( |
1183 uint32_t promise_id) { | 1195 uint32_t promise_id) { |
1184 PromiseMap::iterator it = promises_.find(promise_id); | 1196 PromiseMap::iterator it = promises_.find(promise_id); |
1185 if (it == promises_.end()) | 1197 if (it == promises_.end()) |
1186 return scoped_ptr<CdmPromise>(); | 1198 return scoped_ptr<CdmPromise>(); |
1187 return promises_.take_and_erase(it); | 1199 return promises_.take_and_erase(it); |
1188 } | 1200 } |
1189 | 1201 |
1190 } // namespace content | 1202 } // namespace content |
OLD | NEW |