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

Side by Side 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: Various cleanups Created 5 years, 6 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/pepper/pepper_filesystem_provider_host.h "
6 #include "content/browser/renderer_host/pepper/pepper_filesystem_provider_backen d_chromeos.h"
7 #include "content/public/browser/browser_ppapi_host.h"
8 #include "ppapi/host/dispatch_host_message.h"
9 #include "ppapi/host/ppapi_host.h"
10 #include "ppapi/proxy/ppapi_messages.h"
11
12
13 namespace content {
14
15 PepperFilesystemProviderBackend::~PepperFilesystemProviderBackend(){}
16
17 PepperFilesystemProviderHost::PepperFilesystemProviderHost(
18 BrowserPpapiHost* host, PP_Instance instance, PP_Resource resource)
19 : ResourceHost(
20 host ? host->GetPpapiHost() : nullptr,
21 instance,
22 resource )
23 #if defined(OS_CHROMEOS)
24 , backend_( new PepperFilesystemProviderBackendChromeOS(
25 host,
26 instance,
27 resource) )
28 #endif
29 {
30
31 }
32
33 PepperFilesystemProviderHost::~PepperFilesystemProviderHost() {
34
35 }
36 // This is a dispatcher for all requests
37 // received from the plugin
38 int32_t PepperFilesystemProviderHost::OnResourceMessageReceived(
39 const IPC::Message& msg, ppapi::host::HostMessageContext* context) {
40 if ( !host()->permissions().HasPermission( ppapi::PERMISSION_DEV ) )
41 return PP_ERROR_FAILED;
42
43 PPAPI_BEGIN_MESSAGE_MAP( PepperFilesystemProviderHost, msg )
44 PPAPI_DISPATCH_HOST_RESOURCE_CALL(
45 PpapiHostMsg_FilesystemProvider_Mount,
46 OnHostMsgMount )
47 PPAPI_DISPATCH_HOST_RESOURCE_CALL(
48 PpapiHostMsg_FilesystemProvider_Unmount,
49 OnHostMsgUnmount )
50 PPAPI_DISPATCH_HOST_RESOURCE_CALL(
51 PpapiHostMsg_FilesystemProvider_OperationResponse,
52 OnHostMsgPluginResponse)
53 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
54 PpapiHostMsg_FilesystemProvider_WriteAck,
55 OnHostMsgPluginWriteAck)
56 PPAPI_END_MESSAGE_MAP()
57
58 return PP_ERROR_FAILED;
59 }
60
61 int32_t PepperFilesystemProviderHost::OnHostMsgMount(
62 ppapi::host::HostMessageContext* context, const base::ListValue& request) {
63 if(!backend_.get())
64 return PP_ERROR_NOTSUPPORTED;
65 return backend_->SendMountRequest(context, request);
66 }
67
68 int32_t PepperFilesystemProviderHost::OnHostMsgUnmount(
69 ppapi::host::HostMessageContext* context, std::string filesystem_id) {
70 if(!backend_.get())
71 return PP_ERROR_NOTSUPPORTED;
72 return backend_->SendUnmountRequest(context,filesystem_id);
73 }
74
75 int32_t PepperFilesystemProviderHost::OnHostMsgPluginResponse(
76 ppapi::host::HostMessageContext* context, const base::ListValue& response) {
77 if(!backend_.get())
78 return PP_ERROR_NOTSUPPORTED;
79 return backend_->OnPluginResponse(context,response);
80 }
81
82 int32_t PepperFilesystemProviderHost::OnHostMsgPluginWriteAck(
83 ppapi::host::HostMessageContext* context) {
84 if(!backend_.get())
85 return PP_ERROR_NOTSUPPORTED;
86 return backend_->OnPluginWriteAck(context);
87 }
88
89 } // namespace content
90
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698