| OLD | NEW |
| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 return true; | 312 return true; |
| 313 } | 313 } |
| 314 return NativeFileUtil::DirectoryExists(platform_path); | 314 return NativeFileUtil::DirectoryExists(platform_path); |
| 315 } | 315 } |
| 316 | 316 |
| 317 bool IsolatedFileUtil::IsDirectoryEmpty( | 317 bool IsolatedFileUtil::IsDirectoryEmpty( |
| 318 FileSystemOperationContext* context, | 318 FileSystemOperationContext* context, |
| 319 const FileSystemPath& path) { | 319 const FileSystemPath& path) { |
| 320 std::string filesystem_id; | 320 std::string filesystem_id; |
| 321 FilePath platform_path; | 321 FilePath platform_path; |
| 322 if (!GetPlatformPath(path, &platform_path)) | 322 if (!IsolatedContext::GetInstance()->CrackIsolatedPath( |
| 323 path.internal_path(), &filesystem_id, |
| 324 NULL, &platform_path)) |
| 323 return false; | 325 return false; |
| 324 if (platform_path.empty()) { | 326 if (platform_path.empty()) { |
| 325 // The root directory case. | 327 // The root directory case. |
| 326 std::vector<FilePath> toplevels; | 328 std::vector<FilePath> toplevels; |
| 327 bool success = IsolatedContext::GetInstance()->GetTopLevelPaths( | 329 bool success = IsolatedContext::GetInstance()->GetTopLevelPaths( |
| 328 filesystem_id, &toplevels); | 330 filesystem_id, &toplevels); |
| 329 DCHECK(success); | 331 DCHECK(success); |
| 330 return toplevels.empty(); | 332 return toplevels.empty(); |
| 331 } | 333 } |
| 332 return NativeFileUtil::IsDirectoryEmpty(platform_path); | 334 return NativeFileUtil::IsDirectoryEmpty(platform_path); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 std::string filesystem_id; | 367 std::string filesystem_id; |
| 366 FilePath root_path; | 368 FilePath root_path; |
| 367 if (!IsolatedContext::GetInstance()->CrackIsolatedPath( | 369 if (!IsolatedContext::GetInstance()->CrackIsolatedPath( |
| 368 virtual_path.internal_path(), &filesystem_id, | 370 virtual_path.internal_path(), &filesystem_id, |
| 369 &root_path, platform_path)) | 371 &root_path, platform_path)) |
| 370 return false; | 372 return false; |
| 371 return true; | 373 return true; |
| 372 } | 374 } |
| 373 | 375 |
| 374 } // namespace | 376 } // namespace |
| OLD | NEW |