OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/renderer_host/pepper/pepper_file_ref_host.h" | 5 #include "content/browser/renderer_host/pepper/pepper_file_ref_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "content/browser/renderer_host/pepper/pepper_external_file_ref_backend.
h" | 9 #include "content/browser/renderer_host/pepper/pepper_external_file_ref_backend.
h" |
10 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
" | 10 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 return backend_->CanReadWrite(); | 149 return backend_->CanReadWrite(); |
150 return PP_ERROR_FAILED; | 150 return PP_ERROR_FAILED; |
151 } | 151 } |
152 | 152 |
153 int32_t PepperFileRefHost::OnResourceMessageReceived( | 153 int32_t PepperFileRefHost::OnResourceMessageReceived( |
154 const IPC::Message& msg, | 154 const IPC::Message& msg, |
155 ppapi::host::HostMessageContext* context) { | 155 ppapi::host::HostMessageContext* context) { |
156 if (!backend_) | 156 if (!backend_) |
157 return PP_ERROR_FAILED; | 157 return PP_ERROR_FAILED; |
158 | 158 |
159 IPC_BEGIN_MESSAGE_MAP(PepperFileRefHost, msg) | 159 PPAPI_BEGIN_MESSAGE_MAP(PepperFileRefHost, msg) |
160 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileRef_MakeDirectory, | 160 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileRef_MakeDirectory, |
161 OnMakeDirectory); | 161 OnMakeDirectory) |
162 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileRef_Touch, OnTouch); | 162 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileRef_Touch, OnTouch) |
163 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileRef_Delete, OnDelete); | 163 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileRef_Delete, OnDelete) |
164 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileRef_Rename, OnRename); | 164 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileRef_Rename, OnRename) |
165 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileRef_Query, OnQuery); | 165 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileRef_Query, OnQuery) |
166 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileRef_ReadDirectoryEntries, | 166 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( |
167 OnReadDirectoryEntries); | 167 PpapiHostMsg_FileRef_ReadDirectoryEntries, OnReadDirectoryEntries) |
168 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileRef_GetAbsolutePath, | 168 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileRef_GetAbsolutePath, |
169 OnGetAbsolutePath); | 169 OnGetAbsolutePath) |
170 | 170 PPAPI_END_MESSAGE_MAP() |
171 IPC_END_MESSAGE_MAP() | |
172 return PP_ERROR_FAILED; | 171 return PP_ERROR_FAILED; |
173 } | 172 } |
174 | 173 |
175 int32_t PepperFileRefHost::OnMakeDirectory( | 174 int32_t PepperFileRefHost::OnMakeDirectory( |
176 ppapi::host::HostMessageContext* context, | 175 ppapi::host::HostMessageContext* context, |
177 int32_t make_directory_flags) { | 176 int32_t make_directory_flags) { |
178 int32_t rv = CanCreate(); | 177 int32_t rv = CanCreate(); |
179 if (rv != PP_OK) | 178 if (rv != PP_OK) |
180 return rv; | 179 return rv; |
181 return backend_->MakeDirectory(context->MakeReplyMessageContext(), | 180 return backend_->MakeDirectory(context->MakeReplyMessageContext(), |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 241 |
243 int32_t PepperFileRefHost::OnGetAbsolutePath( | 242 int32_t PepperFileRefHost::OnGetAbsolutePath( |
244 ppapi::host::HostMessageContext* context) { | 243 ppapi::host::HostMessageContext* context) { |
245 if (!host_->GetPpapiHost()->permissions().HasPermission( | 244 if (!host_->GetPpapiHost()->permissions().HasPermission( |
246 ppapi::PERMISSION_PRIVATE)) | 245 ppapi::PERMISSION_PRIVATE)) |
247 return PP_ERROR_NOACCESS; | 246 return PP_ERROR_NOACCESS; |
248 return backend_->GetAbsolutePath(context->MakeReplyMessageContext()); | 247 return backend_->GetAbsolutePath(context->MakeReplyMessageContext()); |
249 } | 248 } |
250 | 249 |
251 } // namespace content | 250 } // namespace content |
OLD | NEW |