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_internal_file_ref_backend.
h" | 5 #include "content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.
h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 void PepperInternalFileRefBackend::ReadDirectoryComplete( | 214 void PepperInternalFileRefBackend::ReadDirectoryComplete( |
215 ppapi::host::ReplyMessageContext context, | 215 ppapi::host::ReplyMessageContext context, |
216 base::PlatformFileError error, | 216 base::PlatformFileError error, |
217 const fileapi::FileSystemOperation::FileEntryList& file_list, | 217 const fileapi::FileSystemOperation::FileEntryList& file_list, |
218 bool has_more) { | 218 bool has_more) { |
219 // The current filesystem backend always returns false. | 219 // The current filesystem backend always returns false. |
220 DCHECK(!has_more); | 220 DCHECK(!has_more); |
221 | 221 |
222 context.params.set_result(ppapi::PlatformFileErrorToPepperError(error)); | 222 context.params.set_result(ppapi::PlatformFileErrorToPepperError(error)); |
223 | 223 |
224 std::vector<ppapi::FileRef_CreateInfo> infos; | 224 std::vector<ppapi::FileRefCreateInfo> infos; |
225 std::vector<PP_FileType> file_types; | 225 std::vector<PP_FileType> file_types; |
226 if (error == base::PLATFORM_FILE_OK && fs_host_.get()) { | 226 if (error == base::PLATFORM_FILE_OK && fs_host_.get()) { |
227 std::string dir_path = path_; | 227 std::string dir_path = path_; |
228 if (dir_path.empty() || dir_path[dir_path.size() - 1] != '/') | 228 if (dir_path.empty() || dir_path[dir_path.size() - 1] != '/') |
229 dir_path += '/'; | 229 dir_path += '/'; |
230 | 230 |
231 for (fileapi::FileSystemOperation::FileEntryList::const_iterator it = | 231 for (fileapi::FileSystemOperation::FileEntryList::const_iterator it = |
232 file_list.begin(); it != file_list.end(); ++it) { | 232 file_list.begin(); it != file_list.end(); ++it) { |
233 if (it->is_directory) | 233 if (it->is_directory) |
234 file_types.push_back(PP_FILETYPE_DIRECTORY); | 234 file_types.push_back(PP_FILETYPE_DIRECTORY); |
235 else | 235 else |
236 file_types.push_back(PP_FILETYPE_REGULAR); | 236 file_types.push_back(PP_FILETYPE_REGULAR); |
237 | 237 |
238 ppapi::FileRef_CreateInfo info; | 238 ppapi::FileRefCreateInfo info; |
239 info.file_system_type = fs_type_; | 239 info.file_system_type = fs_type_; |
240 info.file_system_plugin_resource = fs_host_->pp_resource(); | 240 info.file_system_plugin_resource = fs_host_->pp_resource(); |
241 std::string path = | 241 std::string path = |
242 dir_path + fileapi::FilePathToString(base::FilePath(it->name)); | 242 dir_path + fileapi::FilePathToString(base::FilePath(it->name)); |
243 info.internal_path = path; | 243 info.internal_path = path; |
244 info.display_name = ppapi::GetNameForInternalFilePath(path); | 244 info.display_name = ppapi::GetNameForInternalFilePath(path); |
245 infos.push_back(info); | 245 infos.push_back(info); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 ChildProcessSecurityPolicyImpl* policy = | 297 ChildProcessSecurityPolicyImpl* policy = |
298 ChildProcessSecurityPolicyImpl::GetInstance(); | 298 ChildProcessSecurityPolicyImpl::GetInstance(); |
299 if (!policy->CanReadFileSystemFile(render_process_id_, url) || | 299 if (!policy->CanReadFileSystemFile(render_process_id_, url) || |
300 !policy->CanWriteFileSystemFile(render_process_id_, url)) { | 300 !policy->CanWriteFileSystemFile(render_process_id_, url)) { |
301 return PP_ERROR_NOACCESS; | 301 return PP_ERROR_NOACCESS; |
302 } | 302 } |
303 return PP_OK; | 303 return PP_OK; |
304 } | 304 } |
305 | 305 |
306 } // namespace content | 306 } // namespace content |
OLD | NEW |