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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/pepper_plugin_delegate_impl.cc
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index d2be7ccb80dc8d3e576f38d2d4118ac9ed7013ce..a0c817daabcf7b3a8474cc9d540080bd4d617ee4 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -43,6 +43,7 @@
#include "content/renderer/pepper/content_renderer_pepper_host_factory.h"
#include "content/renderer/pepper/pepper_broker_impl.h"
#include "content/renderer/pepper/pepper_device_enumeration_event_handler.h"
+#include "content/renderer/pepper/pepper_file_system_host.h"
#include "content/renderer/pepper/pepper_hung_plugin_filter.h"
#include "content/renderer/pepper/pepper_in_process_resource_creation.h"
#include "content/renderer/pepper/pepper_platform_audio_input_impl.h"
@@ -340,6 +341,16 @@ void CreateHostForInProcessModule(RenderViewImpl* render_view,
render_view->PpapiPluginCreated(host_impl);
}
+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.
+const HostT* GetRendererResourceHost(
+ PP_Instance instance, PP_Resource resource) {
+ const ppapi::host::PpapiHost* ppapi_host =
+ RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost();
+ if (!resource|| !ppapi_host)
yzshen1 2013/04/08 21:05:16 Missing space before ||.
victorhsieh 2013/04/08 23:44:38 Done.
+ return NULL;
+ return static_cast<HostT*>(ppapi_host->GetResourceHost(resource));
+}
+
} // namespace
PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view)
@@ -1016,15 +1027,25 @@ void PepperPluginDelegateImpl::WillHandleMouseEvent() {
last_mouse_event_target_ = NULL;
}
-bool PepperPluginDelegateImpl::OpenFileSystem(
- const GURL& origin_url,
- fileapi::FileSystemType type,
- long long size,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- FileSystemDispatcher* file_system_dispatcher =
- ChildThread::current()->file_system_dispatcher();
- return file_system_dispatcher->OpenFileSystem(
- origin_url, type, size, true /* create */, dispatcher);
+bool PepperPluginDelegateImpl::IsFileSystemOpened(PP_Instance instance,
+ PP_Resource resource) const {
+ const PepperFileSystemHost* host =
+ GetRendererResourceHost<PepperFileSystemHost>(instance, resource);
+ return host && host->IsOpened();
+}
+
+PP_FileSystemType PepperPluginDelegateImpl::GetFileSystemType(
+ PP_Instance instance, PP_Resource resource) const {
+ const PepperFileSystemHost* host =
+ GetRendererResourceHost<PepperFileSystemHost>(instance, resource);
+ return host ? host->GetType() : PP_FILESYSTEMTYPE_INVALID;
+}
+
+std::string PepperPluginDelegateImpl::GetFileSystemRootUrl(
+ PP_Instance instance, PP_Resource resource) const {
+ const PepperFileSystemHost* host =
+ GetRendererResourceHost<PepperFileSystemHost>(instance, resource);
+ 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.
}
bool PepperPluginDelegateImpl::MakeDirectory(

Powered by Google App Engine
This is Rietveld 408576698