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