Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 15947004: Allow renderer to create pepper ResourceHosts in the browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/pepper_plugin_delegate_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <cstddef> 8 #include <cstddef>
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
(...skipping 24 matching lines...) Expand all
35 #include "content/public/common/media_stream_request.h" 35 #include "content/public/common/media_stream_request.h"
36 #include "content/public/common/referrer.h" 36 #include "content/public/common/referrer.h"
37 #include "content/public/renderer/content_renderer_client.h" 37 #include "content/public/renderer/content_renderer_client.h"
38 #include "content/public/renderer/renderer_restrict_dispatch_group.h" 38 #include "content/public/renderer/renderer_restrict_dispatch_group.h"
39 #include "content/renderer/gamepad_shared_memory_reader.h" 39 #include "content/renderer/gamepad_shared_memory_reader.h"
40 #include "content/renderer/media/media_stream_dispatcher.h" 40 #include "content/renderer/media/media_stream_dispatcher.h"
41 #include "content/renderer/media/pepper_platform_video_decoder_impl.h" 41 #include "content/renderer/media/pepper_platform_video_decoder_impl.h"
42 #include "content/renderer/p2p/socket_dispatcher.h" 42 #include "content/renderer/p2p/socket_dispatcher.h"
43 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" 43 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h"
44 #include "content/renderer/pepper/pepper_broker_impl.h" 44 #include "content/renderer/pepper/pepper_broker_impl.h"
45 #include "content/renderer/pepper/pepper_browser_connection.h"
45 #include "content/renderer/pepper/pepper_device_enumeration_event_handler.h" 46 #include "content/renderer/pepper/pepper_device_enumeration_event_handler.h"
46 #include "content/renderer/pepper/pepper_file_system_host.h" 47 #include "content/renderer/pepper/pepper_file_system_host.h"
47 #include "content/renderer/pepper/pepper_hung_plugin_filter.h" 48 #include "content/renderer/pepper/pepper_hung_plugin_filter.h"
48 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" 49 #include "content/renderer/pepper/pepper_in_process_resource_creation.h"
49 #include "content/renderer/pepper/pepper_in_process_router.h" 50 #include "content/renderer/pepper/pepper_in_process_router.h"
50 #include "content/renderer/pepper/pepper_platform_audio_input_impl.h" 51 #include "content/renderer/pepper/pepper_platform_audio_input_impl.h"
51 #include "content/renderer/pepper/pepper_platform_audio_output_impl.h" 52 #include "content/renderer/pepper/pepper_platform_audio_output_impl.h"
52 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h" 53 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h"
53 #include "content/renderer/pepper/pepper_platform_image_2d_impl.h" 54 #include "content/renderer/pepper/pepper_platform_image_2d_impl.h"
54 #include "content/renderer/pepper/pepper_platform_video_capture_impl.h" 55 #include "content/renderer/pepper/pepper_platform_video_capture_impl.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 render_view->Send(new ViewHostMsg_DidDeleteOutOfProcessPepperInstance( 197 render_view->Send(new ViewHostMsg_DidDeleteOutOfProcessPepperInstance(
197 plugin_child_id_, 198 plugin_child_id_,
198 instance, 199 instance,
199 is_external_)); 200 is_external_));
200 } 201 }
201 } 202 }
202 virtual base::ProcessId GetPeerProcessId() OVERRIDE { 203 virtual base::ProcessId GetPeerProcessId() OVERRIDE {
203 return peer_pid_; 204 return peer_pid_;
204 } 205 }
205 206
207 virtual int GetPluginChildId() OVERRIDE {
208 return plugin_child_id_;
209 }
210
206 ppapi::proxy::HostDispatcher* dispatcher() { return dispatcher_.get(); } 211 ppapi::proxy::HostDispatcher* dispatcher() { return dispatcher_.get(); }
207 212
208 private: 213 private:
209 webkit::ppapi::PluginModule* module_; 214 webkit::ppapi::PluginModule* module_;
210 215
211 base::ProcessId peer_pid_; 216 base::ProcessId peer_pid_;
212 217
213 // ID that the browser process uses to idetify the child process for the 218 // ID that the browser process uses to idetify the child process for the
214 // plugin. This isn't directly useful from our process (the renderer) except 219 // plugin. This isn't directly useful from our process (the renderer) except
215 // in messages to the browser to disambiguate plugins. 220 // in messages to the browser to disambiguate plugins.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 if (!resource || !ppapi_host) 326 if (!resource || !ppapi_host)
322 return NULL; 327 return NULL;
323 return static_cast<HostType*>(ppapi_host->GetResourceHost(resource)); 328 return static_cast<HostType*>(ppapi_host->GetResourceHost(resource));
324 } 329 }
325 330
326 } // namespace 331 } // namespace
327 332
328 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view) 333 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view)
329 : RenderViewObserver(render_view), 334 : RenderViewObserver(render_view),
330 render_view_(render_view), 335 render_view_(render_view),
336 pepper_browser_connection_(this),
331 focused_plugin_(NULL), 337 focused_plugin_(NULL),
332 last_mouse_event_target_(NULL), 338 last_mouse_event_target_(NULL),
333 device_enumeration_event_handler_( 339 device_enumeration_event_handler_(
334 new PepperDeviceEnumerationEventHandler()) { 340 new PepperDeviceEnumerationEventHandler()) {
335 } 341 }
336 342
337 PepperPluginDelegateImpl::~PepperPluginDelegateImpl() { 343 PepperPluginDelegateImpl::~PepperPluginDelegateImpl() {
338 DCHECK(mouse_lock_instances_.empty()); 344 DCHECK(mouse_lock_instances_.empty());
339 } 345 }
340 346
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 base::MessageLoop::current()->PostTask( 1468 base::MessageLoop::current()->PostTask(
1463 FROM_HERE, 1469 FROM_HERE,
1464 base::Bind(&MediaStreamDispatcher::StopEnumerateDevices, 1470 base::Bind(&MediaStreamDispatcher::StopEnumerateDevices,
1465 render_view_->media_stream_dispatcher()->AsWeakPtr(), 1471 render_view_->media_stream_dispatcher()->AsWeakPtr(),
1466 request_id, 1472 request_id,
1467 device_enumeration_event_handler_.get()->AsWeakPtr())); 1473 device_enumeration_event_handler_.get()->AsWeakPtr()));
1468 #endif 1474 #endif
1469 } 1475 }
1470 1476
1471 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) { 1477 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) {
1478 if (pepper_browser_connection_.OnMessageReceived(message))
1479 return true;
1480
1472 bool handled = true; 1481 bool handled = true;
1473 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message) 1482 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message)
1474 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, 1483 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK,
1475 OnTCPSocketConnectACK) 1484 OnTCPSocketConnectACK)
1476 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, 1485 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK,
1477 OnTCPSocketSSLHandshakeACK) 1486 OnTCPSocketSSLHandshakeACK)
1478 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) 1487 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK)
1479 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) 1488 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK)
1480 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SetBoolOptionACK, 1489 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SetBoolOptionACK,
1481 OnTCPSocketSetBoolOptionACK) 1490 OnTCPSocketSetBoolOptionACK)
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 should_close_source); 1695 should_close_source);
1687 } 1696 }
1688 1697
1689 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { 1698 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const {
1690 RendererPpapiHostImpl* host = 1699 RendererPpapiHostImpl* host =
1691 RendererPpapiHostImpl::GetForPPInstance(instance); 1700 RendererPpapiHostImpl::GetForPPInstance(instance);
1692 return host && host->IsRunningInProcess(); 1701 return host && host->IsRunningInProcess();
1693 } 1702 }
1694 1703
1695 } // namespace content 1704 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_delegate_impl.h ('k') | content/renderer/pepper/renderer_ppapi_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698