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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc

Issue 2119283002: Use container::back() and container::pop_back() for content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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.h> 7 #include <string.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 accumulated_file_list->end(), file_list.begin(), file_list.end()); 226 accumulated_file_list->end(), file_list.begin(), file_list.end());
227 if (has_more) 227 if (has_more)
228 return; 228 return;
229 229
230 context.params.set_result(ppapi::FileErrorToPepperError(error)); 230 context.params.set_result(ppapi::FileErrorToPepperError(error));
231 231
232 std::vector<ppapi::FileRefCreateInfo> infos; 232 std::vector<ppapi::FileRefCreateInfo> infos;
233 std::vector<PP_FileType> file_types; 233 std::vector<PP_FileType> file_types;
234 if (error == base::File::FILE_OK && fs_host_.get()) { 234 if (error == base::File::FILE_OK && fs_host_.get()) {
235 std::string dir_path = path_; 235 std::string dir_path = path_;
236 if (dir_path.empty() || dir_path[dir_path.size() - 1] != '/') 236 if (dir_path.empty() || dir_path.back() != '/')
237 dir_path += '/'; 237 dir_path += '/';
238 238
239 for (storage::FileSystemOperation::FileEntryList::const_iterator it = 239 for (const auto& it : *accumulated_file_list) {
240 accumulated_file_list->begin(); 240 file_types.push_back(it.is_directory ? PP_FILETYPE_DIRECTORY
241 it != accumulated_file_list->end(); 241 : PP_FILETYPE_REGULAR);
242 ++it) {
243 if (it->is_directory)
244 file_types.push_back(PP_FILETYPE_DIRECTORY);
245 else
246 file_types.push_back(PP_FILETYPE_REGULAR);
247 242
248 ppapi::FileRefCreateInfo info; 243 ppapi::FileRefCreateInfo info;
249 info.file_system_type = fs_type_; 244 info.file_system_type = fs_type_;
250 info.file_system_plugin_resource = fs_host_->pp_resource(); 245 info.file_system_plugin_resource = fs_host_->pp_resource();
251 std::string path = 246 std::string path =
252 dir_path + storage::FilePathToString(base::FilePath(it->name)); 247 dir_path + storage::FilePathToString(base::FilePath(it.name));
253 info.internal_path = path; 248 info.internal_path = path;
254 info.display_name = ppapi::GetNameForInternalFilePath(path); 249 info.display_name = ppapi::GetNameForInternalFilePath(path);
255 infos.push_back(info); 250 infos.push_back(info);
256 } 251 }
257 } 252 }
258 253
259 host_->SendReply( 254 host_->SendReply(
260 context, 255 context,
261 PpapiPluginMsg_FileRef_ReadDirectoryEntriesReply(infos, file_types)); 256 PpapiPluginMsg_FileRef_ReadDirectoryEntriesReply(infos, file_types));
262 } 257 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 ChildProcessSecurityPolicyImpl* policy = 303 ChildProcessSecurityPolicyImpl* policy =
309 ChildProcessSecurityPolicyImpl::GetInstance(); 304 ChildProcessSecurityPolicyImpl::GetInstance();
310 if (!policy->CanReadFileSystemFile(render_process_id_, url) || 305 if (!policy->CanReadFileSystemFile(render_process_id_, url) ||
311 !policy->CanWriteFileSystemFile(render_process_id_, url)) { 306 !policy->CanWriteFileSystemFile(render_process_id_, url)) {
312 return PP_ERROR_NOACCESS; 307 return PP_ERROR_NOACCESS;
313 } 308 }
314 return PP_OK; 309 return PP_OK;
315 } 310 }
316 311
317 } // namespace content 312 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698