| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper_plugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 } | 1026 } |
| 1027 | 1027 |
| 1028 webkit::ppapi::PluginDelegate::PlatformContext3D* | 1028 webkit::ppapi::PluginDelegate::PlatformContext3D* |
| 1029 PepperPluginDelegateImpl::CreateContext3D() { | 1029 PepperPluginDelegateImpl::CreateContext3D() { |
| 1030 #ifdef ENABLE_GPU | 1030 #ifdef ENABLE_GPU |
| 1031 // If accelerated compositing of plugins is disabled, fail to create a 3D | 1031 // If accelerated compositing of plugins is disabled, fail to create a 3D |
| 1032 // context, because it won't be visible. This allows graceful fallback in the | 1032 // context, because it won't be visible. This allows graceful fallback in the |
| 1033 // modules. | 1033 // modules. |
| 1034 if (!render_view_->webkit_preferences().accelerated_plugins_enabled) | 1034 if (!render_view_->webkit_preferences().accelerated_plugins_enabled) |
| 1035 return NULL; | 1035 return NULL; |
| 1036 WebGraphicsContext3DCommandBufferImpl* context = | 1036 return new PlatformContext3DImpl(this); |
| 1037 static_cast<WebGraphicsContext3DCommandBufferImpl*>( | |
| 1038 render_view_->webview()->graphicsContext3D()); | |
| 1039 if (!context) | |
| 1040 return NULL; | |
| 1041 if (!context->makeContextCurrent() || context->isContextLost()) | |
| 1042 return NULL; | |
| 1043 | |
| 1044 RendererGLContext* parent_context = context->context(); | |
| 1045 if (!parent_context) | |
| 1046 return NULL; | |
| 1047 | |
| 1048 return new PlatformContext3DImpl(parent_context); | |
| 1049 #else | 1037 #else |
| 1050 return NULL; | 1038 return NULL; |
| 1051 #endif | 1039 #endif |
| 1052 } | 1040 } |
| 1053 | 1041 |
| 1054 webkit::ppapi::PluginDelegate::PlatformVideoCapture* | 1042 webkit::ppapi::PluginDelegate::PlatformVideoCapture* |
| 1055 PepperPluginDelegateImpl::CreateVideoCapture( | 1043 PepperPluginDelegateImpl::CreateVideoCapture( |
| 1056 media::VideoCapture::EventHandler* handler) { | 1044 media::VideoCapture::EventHandler* handler) { |
| 1057 return new PlatformVideoCaptureImpl(handler); | 1045 return new PlatformVideoCaptureImpl(handler); |
| 1058 } | 1046 } |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1746 } | 1734 } |
| 1747 | 1735 |
| 1748 bool PepperPluginDelegateImpl::IsInFullscreenMode() { | 1736 bool PepperPluginDelegateImpl::IsInFullscreenMode() { |
| 1749 return render_view_->is_fullscreen(); | 1737 return render_view_->is_fullscreen(); |
| 1750 } | 1738 } |
| 1751 | 1739 |
| 1752 int PepperPluginDelegateImpl::GetRoutingId() const { | 1740 int PepperPluginDelegateImpl::GetRoutingId() const { |
| 1753 return render_view_->routing_id(); | 1741 return render_view_->routing_id(); |
| 1754 } | 1742 } |
| 1755 | 1743 |
| 1744 RendererGLContext* |
| 1745 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { |
| 1746 WebGraphicsContext3DCommandBufferImpl* context = |
| 1747 static_cast<WebGraphicsContext3DCommandBufferImpl*>( |
| 1748 render_view_->webview()->graphicsContext3D()); |
| 1749 if (!context) |
| 1750 return NULL; |
| 1751 if (!context->makeContextCurrent() || context->isContextLost()) |
| 1752 return NULL; |
| 1753 |
| 1754 RendererGLContext* parent_context = context->context(); |
| 1755 if (!parent_context) |
| 1756 return NULL; |
| 1757 return parent_context; |
| 1758 } |
| 1759 |
| 1756 void PepperPluginDelegateImpl::PublishInitialPolicy( | 1760 void PepperPluginDelegateImpl::PublishInitialPolicy( |
| 1757 scoped_refptr<webkit::ppapi::PluginInstance> instance, | 1761 scoped_refptr<webkit::ppapi::PluginInstance> instance, |
| 1758 const std::string& policy) { | 1762 const std::string& policy) { |
| 1759 instance->HandlePolicyUpdate(policy); | 1763 instance->HandlePolicyUpdate(policy); |
| 1760 } | 1764 } |
| OLD | NEW |