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

Unified Diff: content/browser/renderer_host/pepper/pepper_filesystem_provider_host.cc

Issue 1093383002: [WIP] Provided file system from NACL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved several modules to chromeos folder. Created 5 years, 5 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/browser/renderer_host/pepper/pepper_filesystem_provider_host.cc
diff --git a/content/browser/renderer_host/pepper/pepper_filesystem_provider_host.cc b/content/browser/renderer_host/pepper/pepper_filesystem_provider_host.cc
new file mode 100644
index 0000000000000000000000000000000000000000..53cc4d74d055eb8379e892e0ea01a446cd2b75cc
--- /dev/null
+++ b/content/browser/renderer_host/pepper/pepper_filesystem_provider_host.cc
@@ -0,0 +1,101 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/renderer_host/pepper/pepper_filesystem_provider_host.h"
+#include "content/browser/renderer_host/pepper/pepper_filesystem_provider_backend_chromeos.h"
+#include "content/public/browser/browser_ppapi_host.h"
+#include "ppapi/host/dispatch_host_message.h"
+#include "ppapi/host/ppapi_host.h"
+#include "ppapi/proxy/ppapi_messages.h"
+
+
+namespace content {
+
+PepperFilesystemProviderBackend::~PepperFilesystemProviderBackend(){}
+
+PepperFilesystemProviderHost::PepperFilesystemProviderHost(
+ BrowserPpapiHost* host, PP_Instance instance, PP_Resource resource)
+ : ResourceHost(
+ host ? host->GetPpapiHost() : nullptr,
+ instance,
+ resource )
+#if defined(OS_CHROMEOS)
+ , backend_( new PepperFilesystemProviderBackendChromeOS(
+ host,
+ instance,
+ resource) )
+#endif
+{
+
+}
+
+PepperFilesystemProviderHost::~PepperFilesystemProviderHost() {
+
+}
+// This is a dispatcher for all requests
+// received from the plugin
+int32_t PepperFilesystemProviderHost::OnResourceMessageReceived(
+ const IPC::Message& msg, ppapi::host::HostMessageContext* context) {
+ if ( !host()->permissions().HasPermission( ppapi::PERMISSION_DEV ) )
+ return PP_ERROR_FAILED;
+
+ PPAPI_BEGIN_MESSAGE_MAP( PepperFilesystemProviderHost, msg )
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(
+ PpapiHostMsg_FilesystemProvider_Mount,
+ OnHostMsgMount )
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(
+ PpapiHostMsg_FilesystemProvider_Unmount,
+ OnHostMsgUnmount )
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(
+ PpapiHostMsg_FilesystemProvider_OperationResponse,
+ OnHostMsgPluginResponse)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
+ PpapiHostMsg_FilesystemProvider_WriteAck,
+ OnHostMsgPluginWriteAck)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(
+ PpapiHostMsg_FilesystemProvider_Notify,
+ OnHostMsgPluginNotification)
+ PPAPI_END_MESSAGE_MAP()
+
+ return PP_ERROR_FAILED;
+}
+
+int32_t PepperFilesystemProviderHost::OnHostMsgMount(
+ ppapi::host::HostMessageContext* context, const base::ListValue& request) {
+ if(!backend_.get())
+ return PP_ERROR_NOTSUPPORTED;
+ return backend_->SendMountRequest(context, request);
+}
+
+int32_t PepperFilesystemProviderHost::OnHostMsgUnmount(
+ ppapi::host::HostMessageContext* context,
+ const std::string& filesystem_id) {
+ if(!backend_.get())
+ return PP_ERROR_NOTSUPPORTED;
+ return backend_->SendUnmountRequest(context,filesystem_id);
+}
+
+int32_t PepperFilesystemProviderHost::OnHostMsgPluginResponse(
+ ppapi::host::HostMessageContext* context, const base::ListValue& response) {
+ if(!backend_.get())
+ return PP_ERROR_NOTSUPPORTED;
+ return backend_->OnPluginResponse(context,response);
+}
+
+int32_t PepperFilesystemProviderHost::OnHostMsgPluginWriteAck(
+ ppapi::host::HostMessageContext* context) {
+ if (!backend_.get())
+ return PP_ERROR_NOTSUPPORTED;
+ return backend_->OnPluginWriteAck(context);
+}
+
+int32_t PepperFilesystemProviderHost::OnHostMsgPluginNotification(
+ ppapi::host::HostMessageContext* context, const base::ListValue& response) {
+ if (!backend_.get())
+ return PP_ERROR_NOTSUPPORTED;
+ return backend_->OnPluginNotification(context,response);
+}
+
+} // namespace content
+
« no previous file with comments | « content/browser/renderer_host/pepper/pepper_filesystem_provider_host.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698