| 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..bba6d4d6d4f9709876227066ff4b1a566b2037df
|
| --- /dev/null
|
| +++ b/content/browser/renderer_host/pepper/pepper_filesystem_provider_host.cc
|
| @@ -0,0 +1,90 @@
|
| +// 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_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, 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);
|
| +}
|
| +
|
| +} // namespace content
|
| +
|
|
|