Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

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: 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
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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 334
334 ppapi::PpapiPermissions perms( 335 ppapi::PpapiPermissions perms(
335 PepperPluginRegistry::GetInstance()->GetInfoForPlugin( 336 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(
336 webplugin_info)->permissions); 337 webplugin_info)->permissions);
337 RendererPpapiHostImpl* host_impl = 338 RendererPpapiHostImpl* host_impl =
338 RendererPpapiHostImpl::CreateOnModuleForInProcess( 339 RendererPpapiHostImpl::CreateOnModuleForInProcess(
339 module, perms); 340 module, perms);
340 render_view->PpapiPluginCreated(host_impl); 341 render_view->PpapiPluginCreated(host_impl);
341 } 342 }
342 343
344 template <typename HostT>
yzshen1 2013/04/08 21:05:16 nit: It seems better to use full name HostType.
victorhsieh 2013/04/08 23:44:38 Done.
345 const HostT* GetRendererResourceHost(
346 PP_Instance instance, PP_Resource resource) {
347 const ppapi::host::PpapiHost* ppapi_host =
348 RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost();
349 if (!resource|| !ppapi_host)
yzshen1 2013/04/08 21:05:16 Missing space before ||.
victorhsieh 2013/04/08 23:44:38 Done.
350 return NULL;
351 return static_cast<HostT*>(ppapi_host->GetResourceHost(resource));
352 }
353
343 } // namespace 354 } // namespace
344 355
345 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view) 356 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view)
346 : RenderViewObserver(render_view), 357 : RenderViewObserver(render_view),
347 render_view_(render_view), 358 render_view_(render_view),
348 focused_plugin_(NULL), 359 focused_plugin_(NULL),
349 last_mouse_event_target_(NULL), 360 last_mouse_event_target_(NULL),
350 device_enumeration_event_handler_( 361 device_enumeration_event_handler_(
351 new PepperDeviceEnumerationEventHandler()) { 362 new PepperDeviceEnumerationEventHandler()) {
352 } 363 }
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 // This method is called for every mouse event that the render view receives. 1020 // This method is called for every mouse event that the render view receives.
1010 // And then the mouse event is forwarded to WebKit, which dispatches it to the 1021 // And then the mouse event is forwarded to WebKit, which dispatches it to the
1011 // event target. Potentially a Pepper plugin will receive the event. 1022 // event target. Potentially a Pepper plugin will receive the event.
1012 // In order to tell whether a plugin gets the last mouse event and which it 1023 // In order to tell whether a plugin gets the last mouse event and which it
1013 // is, we set |last_mouse_event_target_| to NULL here. If a plugin gets the 1024 // is, we set |last_mouse_event_target_| to NULL here. If a plugin gets the
1014 // event, it will notify us via DidReceiveMouseEvent() and set itself as 1025 // event, it will notify us via DidReceiveMouseEvent() and set itself as
1015 // |last_mouse_event_target_|. 1026 // |last_mouse_event_target_|.
1016 last_mouse_event_target_ = NULL; 1027 last_mouse_event_target_ = NULL;
1017 } 1028 }
1018 1029
1019 bool PepperPluginDelegateImpl::OpenFileSystem( 1030 bool PepperPluginDelegateImpl::IsFileSystemOpened(PP_Instance instance,
1020 const GURL& origin_url, 1031 PP_Resource resource) const {
1021 fileapi::FileSystemType type, 1032 const PepperFileSystemHost* host =
1022 long long size, 1033 GetRendererResourceHost<PepperFileSystemHost>(instance, resource);
1023 fileapi::FileSystemCallbackDispatcher* dispatcher) { 1034 return host && host->IsOpened();
1024 FileSystemDispatcher* file_system_dispatcher = 1035 }
1025 ChildThread::current()->file_system_dispatcher(); 1036
1026 return file_system_dispatcher->OpenFileSystem( 1037 PP_FileSystemType PepperPluginDelegateImpl::GetFileSystemType(
1027 origin_url, type, size, true /* create */, dispatcher); 1038 PP_Instance instance, PP_Resource resource) const {
1039 const PepperFileSystemHost* host =
1040 GetRendererResourceHost<PepperFileSystemHost>(instance, resource);
1041 return host ? host->GetType() : PP_FILESYSTEMTYPE_INVALID;
1042 }
1043
1044 std::string PepperPluginDelegateImpl::GetFileSystemRootUrl(
1045 PP_Instance instance, PP_Resource resource) const {
1046 const PepperFileSystemHost* host =
1047 GetRendererResourceHost<PepperFileSystemHost>(instance, resource);
1048 return host ? host->GetRootUrl() : "";
yzshen1 2013/04/08 21:05:16 nit: please use std::string() instead of "".
victorhsieh 2013/04/08 23:44:38 Done.
1028 } 1049 }
1029 1050
1030 bool PepperPluginDelegateImpl::MakeDirectory( 1051 bool PepperPluginDelegateImpl::MakeDirectory(
1031 const GURL& path, 1052 const GURL& path,
1032 bool recursive, 1053 bool recursive,
1033 fileapi::FileSystemCallbackDispatcher* dispatcher) { 1054 fileapi::FileSystemCallbackDispatcher* dispatcher) {
1034 FileSystemDispatcher* file_system_dispatcher = 1055 FileSystemDispatcher* file_system_dispatcher =
1035 ChildThread::current()->file_system_dispatcher(); 1056 ChildThread::current()->file_system_dispatcher();
1036 return file_system_dispatcher->Create( 1057 return file_system_dispatcher->Create(
1037 path, false, true, recursive, dispatcher); 1058 path, false, true, recursive, dispatcher);
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 base::PlatformFile handle, 1634 base::PlatformFile handle,
1614 base::ProcessId target_process_id, 1635 base::ProcessId target_process_id,
1615 bool should_close_source) const { 1636 bool should_close_source) const {
1616 return BrokerGetFileHandleForProcess( 1637 return BrokerGetFileHandleForProcess(
1617 handle, 1638 handle,
1618 target_process_id, 1639 target_process_id,
1619 should_close_source); 1640 should_close_source);
1620 } 1641 }
1621 1642
1622 } // namespace content 1643 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698