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

Side by Side Diff: webkit/fileapi/isolated_file_util.cc

Issue 10817006: Add more FS types and introduce type field into IsolatedContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/fileapi/isolated_file_util.h" 5 #include "webkit/fileapi/isolated_file_util.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 IsolatedContext::GetInstance()->CreateVirtualRootPath(filesystem_id); 253 IsolatedContext::GetInstance()->CreateVirtualRootPath(filesystem_id);
254 254
255 if (!cracked_path.empty()) { 255 if (!cracked_path.empty()) {
256 return new PathConverterEnumerator( 256 return new PathConverterEnumerator(
257 NativeFileUtil::CreateFileEnumerator(cracked_path, recursive), 257 NativeFileUtil::CreateFileEnumerator(cracked_path, recursive),
258 virtual_base_path.AppendASCII(root_info.name), root_info.path); 258 virtual_base_path.AppendASCII(root_info.name), root_info.path);
259 } 259 }
260 260
261 // Root path case. 261 // Root path case.
262 std::vector<FileInfo> toplevels; 262 std::vector<FileInfo> toplevels;
263 IsolatedContext::GetInstance()->GetRegisteredFileInfo( 263 IsolatedContext::GetInstance()->GetDraggedFileInfo(
264 filesystem_id, &toplevels); 264 filesystem_id, &toplevels);
265 if (!recursive) 265 if (!recursive)
266 return new SetFileEnumerator(toplevels, root.path()); 266 return new SetFileEnumerator(toplevels, root.path());
267 return new RecursiveSetFileEnumerator( 267 return new RecursiveSetFileEnumerator(
268 virtual_base_path, toplevels, root.path()); 268 virtual_base_path, toplevels, root.path());
269 } 269 }
270 270
271 PlatformFileError IsolatedFileUtil::GetLocalFilePath( 271 PlatformFileError IsolatedFileUtil::GetLocalFilePath(
272 FileSystemOperationContext* context, 272 FileSystemOperationContext* context,
273 const FileSystemURL& file_system_url, 273 const FileSystemURL& file_system_url,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 const FileSystemURL& url) { 330 const FileSystemURL& url) {
331 std::string filesystem_id; 331 std::string filesystem_id;
332 FilePath platform_path; 332 FilePath platform_path;
333 if (!IsolatedContext::GetInstance()->CrackIsolatedPath( 333 if (!IsolatedContext::GetInstance()->CrackIsolatedPath(
334 url.path(), &filesystem_id, 334 url.path(), &filesystem_id,
335 NULL, &platform_path)) 335 NULL, &platform_path))
336 return false; 336 return false;
337 if (platform_path.empty()) { 337 if (platform_path.empty()) {
338 // The root directory case. 338 // The root directory case.
339 std::vector<FileInfo> toplevels; 339 std::vector<FileInfo> toplevels;
340 bool success = IsolatedContext::GetInstance()->GetRegisteredFileInfo( 340 bool success = IsolatedContext::GetInstance()->GetDraggedFileInfo(
341 filesystem_id, &toplevels); 341 filesystem_id, &toplevels);
342 DCHECK(success); 342 DCHECK(success);
343 return toplevels.empty(); 343 return toplevels.empty();
344 } 344 }
345 return NativeFileUtil::IsDirectoryEmpty(platform_path); 345 return NativeFileUtil::IsDirectoryEmpty(platform_path);
346 } 346 }
347 347
348 PlatformFileError IsolatedFileUtil::CopyOrMoveFile( 348 PlatformFileError IsolatedFileUtil::CopyOrMoveFile(
349 FileSystemOperationContext* context, 349 FileSystemOperationContext* context,
350 const FileSystemURL& src_url, 350 const FileSystemURL& src_url,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 FilePath* platform_path) const { 388 FilePath* platform_path) const {
389 DCHECK(platform_path); 389 DCHECK(platform_path);
390 std::string filesystem_id; 390 std::string filesystem_id;
391 if (!IsolatedContext::GetInstance()->CrackIsolatedPath( 391 if (!IsolatedContext::GetInstance()->CrackIsolatedPath(
392 url.path(), &filesystem_id, NULL, platform_path)) 392 url.path(), &filesystem_id, NULL, platform_path))
393 return false; 393 return false;
394 return true; 394 return true;
395 } 395 }
396 396
397 } // namespace 397 } // namespace
OLDNEW
« no previous file with comments | « webkit/fileapi/isolated_context_unittest.cc ('k') | webkit/fileapi/isolated_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698