| 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 "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 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 | 1539 |
| 1540 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); | 1540 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); |
| 1541 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); | 1541 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); |
| 1542 | 1542 |
| 1543 plugin_decryption_interface_->Decrypt(pp_instance(), | 1543 plugin_decryption_interface_->Decrypt(pp_instance(), |
| 1544 encrypted_resource, | 1544 encrypted_resource, |
| 1545 &block_info); | 1545 &block_info); |
| 1546 return true; | 1546 return true; |
| 1547 } | 1547 } |
| 1548 | 1548 |
| 1549 bool PluginInstance::ResetVideoDecoder() { |
| 1550 if (!LoadContentDecryptorInterface()) |
| 1551 return false; |
| 1552 |
| 1553 // TODO(tomfinegan): Add video decoder reset request tracking. |
| 1554 plugin_decryption_interface_->ResetVideoDecoder(pp_instance(), 0); |
| 1555 return true; |
| 1556 } |
| 1557 |
| 1558 bool PluginInstance::StopVideoDecoder() { |
| 1559 if (!LoadContentDecryptorInterface()) |
| 1560 return false; |
| 1561 |
| 1562 // TODO(tomfinegan): Add video decoder stop request tracking. |
| 1563 plugin_decryption_interface_->StopVideoDecoder(pp_instance(), 0); |
| 1564 return true; |
| 1565 } |
| 1566 |
| 1549 // Note: this method can be used with an unencrypted frame. | 1567 // Note: this method can be used with an unencrypted frame. |
| 1550 bool PluginInstance::DecryptAndDecodeFrame( | 1568 bool PluginInstance::DecryptAndDecodeFrame( |
| 1551 const scoped_refptr<media::DecoderBuffer>& encrypted_frame, | 1569 const scoped_refptr<media::DecoderBuffer>& encrypted_frame, |
| 1552 const media::Decryptor::DecryptCB& decrypt_cb) { | 1570 const media::Decryptor::DecryptCB& decrypt_cb) { |
| 1553 if (!LoadContentDecryptorInterface()) | 1571 if (!LoadContentDecryptorInterface()) |
| 1554 return false; | 1572 return false; |
| 1555 | 1573 |
| 1556 ScopedPPResource encrypted_resource(MakeBufferResource( | 1574 ScopedPPResource encrypted_resource(MakeBufferResource( |
| 1557 pp_instance(), | 1575 pp_instance(), |
| 1558 encrypted_frame->GetData(), | 1576 encrypted_frame->GetData(), |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2272 } | 2290 } |
| 2273 | 2291 |
| 2274 DCHECK(decryptor_client_); | 2292 DCHECK(decryptor_client_); |
| 2275 decryptor_client_->KeyError( | 2293 decryptor_client_->KeyError( |
| 2276 key_system_string->value(), | 2294 key_system_string->value(), |
| 2277 session_id_string->value(), | 2295 session_id_string->value(), |
| 2278 static_cast<media::Decryptor::KeyError>(media_error), | 2296 static_cast<media::Decryptor::KeyError>(media_error), |
| 2279 system_code); | 2297 system_code); |
| 2280 } | 2298 } |
| 2281 | 2299 |
| 2300 void PluginInstance::DecoderReset(PP_Instance instance, uint32_t request_id) { |
| 2301 // TODO(tomfinegan): Add decoder reset completion handling. |
| 2302 } |
| 2303 |
| 2304 void PluginInstance::DecoderStopped(PP_Instance instance, |
| 2305 uint32_t request_id) { |
| 2306 // TODO(tomfinegan): Add decoder stop completion handling. |
| 2307 } |
| 2308 |
| 2282 void PluginInstance::DeliverBlock(PP_Instance instance, | 2309 void PluginInstance::DeliverBlock(PP_Instance instance, |
| 2283 PP_Resource decrypted_block, | 2310 PP_Resource decrypted_block, |
| 2284 const PP_DecryptedBlockInfo* block_info) { | 2311 const PP_DecryptedBlockInfo* block_info) { |
| 2285 DCHECK(block_info); | 2312 DCHECK(block_info); |
| 2286 DecryptionCBMap::iterator found = pending_decryption_cbs_.find( | 2313 DecryptionCBMap::iterator found = pending_decryption_cbs_.find( |
| 2287 block_info->tracking_info.request_id); | 2314 block_info->tracking_info.request_id); |
| 2288 if (found == pending_decryption_cbs_.end()) | 2315 if (found == pending_decryption_cbs_.end()) |
| 2289 return; | 2316 return; |
| 2290 media::Decryptor::DecryptCB decrypt_cb = found->second; | 2317 media::Decryptor::DecryptCB decrypt_cb = found->second; |
| 2291 pending_decryption_cbs_.erase(found); | 2318 pending_decryption_cbs_.erase(found); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2708 screen_size_for_fullscreen_ = gfx::Size(); | 2735 screen_size_for_fullscreen_ = gfx::Size(); |
| 2709 WebElement element = container_->element(); | 2736 WebElement element = container_->element(); |
| 2710 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2737 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2711 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2738 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2712 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2739 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2713 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2740 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2714 } | 2741 } |
| 2715 | 2742 |
| 2716 } // namespace ppapi | 2743 } // namespace ppapi |
| 2717 } // namespace webkit | 2744 } // namespace webkit |
| OLD | NEW |