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

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

Issue 13726024: Refactor FileSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NON_EXPORTED_BASE Created 7 years, 8 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
« no previous file with comments | « content/renderer/pepper/pepper_plugin_delegate_impl.h ('k') | ppapi/ppapi_proxy.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25 matching lines...) Expand all
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_device_enumeration_event_handler.h" 45 #include "content/renderer/pepper/pepper_device_enumeration_event_handler.h"
46 #include "content/renderer/pepper/pepper_file_system_host.h"
46 #include "content/renderer/pepper/pepper_hung_plugin_filter.h" 47 #include "content/renderer/pepper/pepper_hung_plugin_filter.h"
47 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" 48 #include "content/renderer/pepper/pepper_in_process_resource_creation.h"
48 #include "content/renderer/pepper/pepper_platform_audio_input_impl.h" 49 #include "content/renderer/pepper/pepper_platform_audio_input_impl.h"
49 #include "content/renderer/pepper/pepper_platform_audio_output_impl.h" 50 #include "content/renderer/pepper/pepper_platform_audio_output_impl.h"
50 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h" 51 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h"
51 #include "content/renderer/pepper/pepper_platform_image_2d_impl.h" 52 #include "content/renderer/pepper/pepper_platform_image_2d_impl.h"
52 #include "content/renderer/pepper/pepper_platform_video_capture_impl.h" 53 #include "content/renderer/pepper/pepper_platform_video_capture_impl.h"
53 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h" 54 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h"
54 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" 55 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
55 #include "content/renderer/render_thread_impl.h" 56 #include "content/renderer/render_thread_impl.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 337
337 ppapi::PpapiPermissions perms( 338 ppapi::PpapiPermissions perms(
338 PepperPluginRegistry::GetInstance()->GetInfoForPlugin( 339 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(
339 webplugin_info)->permissions); 340 webplugin_info)->permissions);
340 RendererPpapiHostImpl* host_impl = 341 RendererPpapiHostImpl* host_impl =
341 RendererPpapiHostImpl::CreateOnModuleForInProcess( 342 RendererPpapiHostImpl::CreateOnModuleForInProcess(
342 module, perms); 343 module, perms);
343 render_view->PpapiPluginCreated(host_impl); 344 render_view->PpapiPluginCreated(host_impl);
344 } 345 }
345 346
347 template <typename HostType>
348 const HostType* GetRendererResourceHost(
349 PP_Instance instance, PP_Resource resource) {
350 const ppapi::host::PpapiHost* ppapi_host =
351 RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost();
352 if (!resource || !ppapi_host)
353 return NULL;
354 return static_cast<HostType*>(ppapi_host->GetResourceHost(resource));
355 }
356
346 } // namespace 357 } // namespace
347 358
348 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view) 359 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view)
349 : RenderViewObserver(render_view), 360 : RenderViewObserver(render_view),
350 render_view_(render_view), 361 render_view_(render_view),
351 focused_plugin_(NULL), 362 focused_plugin_(NULL),
352 last_mouse_event_target_(NULL), 363 last_mouse_event_target_(NULL),
353 device_enumeration_event_handler_( 364 device_enumeration_event_handler_(
354 new PepperDeviceEnumerationEventHandler()) { 365 new PepperDeviceEnumerationEventHandler()) {
355 } 366 }
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 // This method is called for every mouse event that the render view receives. 1023 // This method is called for every mouse event that the render view receives.
1013 // And then the mouse event is forwarded to WebKit, which dispatches it to the 1024 // And then the mouse event is forwarded to WebKit, which dispatches it to the
1014 // event target. Potentially a Pepper plugin will receive the event. 1025 // event target. Potentially a Pepper plugin will receive the event.
1015 // In order to tell whether a plugin gets the last mouse event and which it 1026 // In order to tell whether a plugin gets the last mouse event and which it
1016 // is, we set |last_mouse_event_target_| to NULL here. If a plugin gets the 1027 // is, we set |last_mouse_event_target_| to NULL here. If a plugin gets the
1017 // event, it will notify us via DidReceiveMouseEvent() and set itself as 1028 // event, it will notify us via DidReceiveMouseEvent() and set itself as
1018 // |last_mouse_event_target_|. 1029 // |last_mouse_event_target_|.
1019 last_mouse_event_target_ = NULL; 1030 last_mouse_event_target_ = NULL;
1020 } 1031 }
1021 1032
1022 bool PepperPluginDelegateImpl::OpenFileSystem( 1033 bool PepperPluginDelegateImpl::IsFileSystemOpened(PP_Instance instance,
1023 const GURL& origin_url, 1034 PP_Resource resource) const {
1024 fileapi::FileSystemType type, 1035 const PepperFileSystemHost* host =
1025 long long size, 1036 GetRendererResourceHost<PepperFileSystemHost>(instance, resource);
1026 fileapi::FileSystemCallbackDispatcher* dispatcher) { 1037 return host && host->IsOpened();
1027 FileSystemDispatcher* file_system_dispatcher = 1038 }
1028 ChildThread::current()->file_system_dispatcher(); 1039
1029 return file_system_dispatcher->OpenFileSystem( 1040 PP_FileSystemType PepperPluginDelegateImpl::GetFileSystemType(
1030 origin_url, type, size, true /* create */, dispatcher); 1041 PP_Instance instance, PP_Resource resource) const {
1042 const PepperFileSystemHost* host =
1043 GetRendererResourceHost<PepperFileSystemHost>(instance, resource);
1044 return host ? host->GetType() : PP_FILESYSTEMTYPE_INVALID;
1045 }
1046
1047 GURL PepperPluginDelegateImpl::GetFileSystemRootUrl(
1048 PP_Instance instance, PP_Resource resource) const {
1049 const PepperFileSystemHost* host =
1050 GetRendererResourceHost<PepperFileSystemHost>(instance, resource);
1051 return host ? host->GetRootUrl() : GURL();
1031 } 1052 }
1032 1053
1033 bool PepperPluginDelegateImpl::MakeDirectory( 1054 bool PepperPluginDelegateImpl::MakeDirectory(
1034 const GURL& path, 1055 const GURL& path,
1035 bool recursive, 1056 bool recursive,
1036 fileapi::FileSystemCallbackDispatcher* dispatcher) { 1057 fileapi::FileSystemCallbackDispatcher* dispatcher) {
1037 FileSystemDispatcher* file_system_dispatcher = 1058 FileSystemDispatcher* file_system_dispatcher =
1038 ChildThread::current()->file_system_dispatcher(); 1059 ChildThread::current()->file_system_dispatcher();
1039 return file_system_dispatcher->Create( 1060 return file_system_dispatcher->Create(
1040 path, false, true, recursive, dispatcher); 1061 path, false, true, recursive, dispatcher);
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 IPC::PlatformFileForTransit PepperPluginDelegateImpl::ShareHandleWithRemote( 1636 IPC::PlatformFileForTransit PepperPluginDelegateImpl::ShareHandleWithRemote(
1616 base::PlatformFile handle, 1637 base::PlatformFile handle,
1617 base::ProcessId target_process_id, 1638 base::ProcessId target_process_id,
1618 bool should_close_source) const { 1639 bool should_close_source) const {
1619 return BrokerGetFileHandleForProcess( 1640 return BrokerGetFileHandleForProcess(
1620 handle, 1641 handle,
1621 target_process_id, 1642 target_process_id,
1622 should_close_source); 1643 should_close_source);
1623 } 1644 }
1624 1645
1646 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const {
1647 RendererPpapiHostImpl* host =
1648 RendererPpapiHostImpl::GetForPPInstance(instance);
1649 return host && host->IsRunningInProcess();
1650 }
1651
1625 } // namespace content 1652 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_delegate_impl.h ('k') | ppapi/ppapi_proxy.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698