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_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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/file_util_proxy.h" | 14 #include "base/file_util_proxy.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/string_split.h" | 18 #include "base/string_split.h" |
19 #include "base/sync_socket.h" | 19 #include "base/sync_socket.h" |
20 #include "base/time.h" | 20 #include "base/time.h" |
21 #include "content/common/child_process.h" | 21 #include "content/common/child_process.h" |
22 #include "content/common/child_process_messages.h" | 22 #include "content/common/child_process_messages.h" |
23 #include "content/common/child_thread.h" | 23 #include "content/common/child_thread.h" |
24 #include "content/common/file_system/file_system_dispatcher.h" | 24 #include "content/common/file_system/file_system_dispatcher.h" |
25 #include "content/common/file_system_messages.h" | 25 #include "content/common/file_system_messages.h" |
| 26 #include "content/common/gpu/client/content_gl_context.h" |
| 27 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
26 #include "content/common/media/audio_messages.h" | 28 #include "content/common/media/audio_messages.h" |
27 #include "content/common/pepper_file_messages.h" | 29 #include "content/common/pepper_file_messages.h" |
28 #include "content/common/pepper_plugin_registry.h" | 30 #include "content/common/pepper_plugin_registry.h" |
29 #include "content/common/pepper_messages.h" | 31 #include "content/common/pepper_messages.h" |
30 #include "content/common/quota_dispatcher.h" | 32 #include "content/common/quota_dispatcher.h" |
31 #include "content/common/view_messages.h" | 33 #include "content/common/view_messages.h" |
32 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
33 #include "content/public/renderer/content_renderer_client.h" | 35 #include "content/public/renderer/content_renderer_client.h" |
34 #include "content/renderer/gamepad_shared_memory_reader.h" | 36 #include "content/renderer/gamepad_shared_memory_reader.h" |
35 #include "content/renderer/gpu/command_buffer_proxy.h" | |
36 #include "content/renderer/gpu/gpu_channel_host.h" | |
37 #include "content/renderer/gpu/renderer_gl_context.h" | |
38 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" | |
39 #include "content/renderer/media/audio_input_message_filter.h" | 37 #include "content/renderer/media/audio_input_message_filter.h" |
40 #include "content/renderer/media/audio_message_filter.h" | 38 #include "content/renderer/media/audio_message_filter.h" |
41 #include "content/renderer/media/pepper_platform_video_decoder_impl.h" | 39 #include "content/renderer/media/pepper_platform_video_decoder_impl.h" |
42 #include "content/renderer/media/video_capture_impl_manager.h" | 40 #include "content/renderer/media/video_capture_impl_manager.h" |
43 #include "content/renderer/p2p/p2p_transport_impl.h" | 41 #include "content/renderer/p2p/p2p_transport_impl.h" |
44 #include "content/renderer/pepper_platform_context_3d_impl.h" | 42 #include "content/renderer/pepper_platform_context_3d_impl.h" |
45 #include "content/renderer/render_thread_impl.h" | 43 #include "content/renderer/render_thread_impl.h" |
46 #include "content/renderer/render_view_impl.h" | 44 #include "content/renderer/render_view_impl.h" |
47 #include "content/renderer/render_widget_fullscreen_pepper.h" | 45 #include "content/renderer/render_widget_fullscreen_pepper.h" |
48 #include "content/renderer/webplugin_delegate_proxy.h" | 46 #include "content/renderer/webplugin_delegate_proxy.h" |
(...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2062 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = | 2060 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = |
2063 udp_sockets_.Lookup(socket_id); | 2061 udp_sockets_.Lookup(socket_id); |
2064 if (socket) | 2062 if (socket) |
2065 socket->OnSendToCompleted(succeeded, bytes_written); | 2063 socket->OnSendToCompleted(succeeded, bytes_written); |
2066 } | 2064 } |
2067 | 2065 |
2068 int PepperPluginDelegateImpl::GetRoutingId() const { | 2066 int PepperPluginDelegateImpl::GetRoutingId() const { |
2069 return render_view_->routing_id(); | 2067 return render_view_->routing_id(); |
2070 } | 2068 } |
2071 | 2069 |
2072 RendererGLContext* | 2070 ContentGLContext* |
2073 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { | 2071 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { |
2074 WebGraphicsContext3DCommandBufferImpl* context = | 2072 WebGraphicsContext3DCommandBufferImpl* context = |
2075 static_cast<WebGraphicsContext3DCommandBufferImpl*>( | 2073 static_cast<WebGraphicsContext3DCommandBufferImpl*>( |
2076 render_view_->webview()->graphicsContext3D()); | 2074 render_view_->webview()->graphicsContext3D()); |
2077 if (!context) | 2075 if (!context) |
2078 return NULL; | 2076 return NULL; |
2079 if (!context->makeContextCurrent() || context->isContextLost()) | 2077 if (!context->makeContextCurrent() || context->isContextLost()) |
2080 return NULL; | 2078 return NULL; |
2081 | 2079 |
2082 RendererGLContext* parent_context = context->context(); | 2080 ContentGLContext* parent_context = context->context(); |
2083 if (!parent_context) | 2081 if (!parent_context) |
2084 return NULL; | 2082 return NULL; |
2085 return parent_context; | 2083 return parent_context; |
2086 } | 2084 } |
2087 | 2085 |
2088 bool PepperPluginDelegateImpl::CanUseSocketAPIs() { | 2086 bool PepperPluginDelegateImpl::CanUseSocketAPIs() { |
2089 WebView* webview = render_view_->webview(); | 2087 WebView* webview = render_view_->webview(); |
2090 WebFrame* main_frame = webview ? webview->mainFrame() : NULL; | 2088 WebFrame* main_frame = webview ? webview->mainFrame() : NULL; |
2091 GURL url(main_frame ? GURL(main_frame->document().url()) : GURL()); | 2089 GURL url(main_frame ? GURL(main_frame->document().url()) : GURL()); |
2092 if (!url.is_valid()) | 2090 if (!url.is_valid()) |
(...skipping 16 matching lines...) Expand all Loading... |
2109 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter( | 2107 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter( |
2110 webkit::ppapi::PluginInstance* instance) { | 2108 webkit::ppapi::PluginInstance* instance) { |
2111 LockTargetMap::iterator it = mouse_lock_instances_.find(instance); | 2109 LockTargetMap::iterator it = mouse_lock_instances_.find(instance); |
2112 if (it != mouse_lock_instances_.end()) { | 2110 if (it != mouse_lock_instances_.end()) { |
2113 MouseLockDispatcher::LockTarget* target = it->second; | 2111 MouseLockDispatcher::LockTarget* target = it->second; |
2114 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); | 2112 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); |
2115 delete target; | 2113 delete target; |
2116 mouse_lock_instances_.erase(it); | 2114 mouse_lock_instances_.erase(it); |
2117 } | 2115 } |
2118 } | 2116 } |
OLD | NEW |