obfuscated_file_util_disk_delegate.cc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "storage/browser/file_system/obfuscated_file_util_disk_delegate.h"
  5. #include "base/files/file_util.h"
  6. #include "storage/browser/file_system/native_file_util.h"
  7. namespace storage {
  8. ObfuscatedFileUtilDiskDelegate::ObfuscatedFileUtilDiskDelegate() = default;
  9. ObfuscatedFileUtilDiskDelegate::~ObfuscatedFileUtilDiskDelegate() = default;
  10. bool ObfuscatedFileUtilDiskDelegate::DirectoryExists(
  11. const base::FilePath& path) {
  12. return base::DirectoryExists(path);
  13. }
  14. size_t ObfuscatedFileUtilDiskDelegate::ComputeDirectorySize(
  15. const base::FilePath& path) {
  16. return base::ComputeDirectorySize(path);
  17. }
  18. bool ObfuscatedFileUtilDiskDelegate::DeleteFileOrDirectory(
  19. const base::FilePath& path,
  20. bool recursive) {
  21. if (!recursive)
  22. return base::DeleteFile(path);
  23. return base::DeletePathRecursively(path);
  24. }
  25. bool ObfuscatedFileUtilDiskDelegate::IsLink(const base::FilePath& file_path) {
  26. return base::IsLink(file_path);
  27. }
  28. bool ObfuscatedFileUtilDiskDelegate::PathExists(const base::FilePath& path) {
  29. return base::PathExists(path);
  30. }
  31. NativeFileUtil::CopyOrMoveMode
  32. ObfuscatedFileUtilDiskDelegate::CopyOrMoveModeForDestination(
  33. const FileSystemURL& dest_url,
  34. bool copy) {
  35. return NativeFileUtil::CopyOrMoveModeForDestination(dest_url, copy);
  36. }
  37. base::File ObfuscatedFileUtilDiskDelegate::CreateOrOpen(
  38. const base::FilePath& path,
  39. uint32_t file_flags) {
  40. return NativeFileUtil::CreateOrOpen(path, file_flags);
  41. }
  42. base::File::Error ObfuscatedFileUtilDiskDelegate::EnsureFileExists(
  43. const base::FilePath& path,
  44. bool* created) {
  45. return NativeFileUtil::EnsureFileExists(path, created);
  46. }
  47. base::File::Error ObfuscatedFileUtilDiskDelegate::CreateDirectory(
  48. const base::FilePath& path,
  49. bool exclusive,
  50. bool recursive) {
  51. return NativeFileUtil::CreateDirectory(path, exclusive, recursive);
  52. }
  53. base::File::Error ObfuscatedFileUtilDiskDelegate::GetFileInfo(
  54. const base::FilePath& path,
  55. base::File::Info* file_info) {
  56. return NativeFileUtil::GetFileInfo(path, file_info);
  57. }
  58. base::File::Error ObfuscatedFileUtilDiskDelegate::Touch(
  59. const base::FilePath& path,
  60. const base::Time& last_access_time,
  61. const base::Time& last_modified_time) {
  62. return NativeFileUtil::Touch(path, last_access_time, last_modified_time);
  63. }
  64. base::File::Error ObfuscatedFileUtilDiskDelegate::Truncate(
  65. const base::FilePath& path,
  66. int64_t length) {
  67. return NativeFileUtil::Truncate(path, length);
  68. }
  69. base::File::Error ObfuscatedFileUtilDiskDelegate::CopyOrMoveFile(
  70. const base::FilePath& src_path,
  71. const base::FilePath& dest_path,
  72. FileSystemOperation::CopyOrMoveOptionSet options,
  73. NativeFileUtil::CopyOrMoveMode mode) {
  74. return NativeFileUtil::CopyOrMoveFile(src_path, dest_path, options, mode);
  75. }
  76. base::File::Error ObfuscatedFileUtilDiskDelegate::CopyInForeignFile(
  77. const base::FilePath& src_path,
  78. const base::FilePath& dest_path,
  79. FileSystemOperation::CopyOrMoveOptionSet options,
  80. NativeFileUtil::CopyOrMoveMode mode) {
  81. return NativeFileUtil::CopyOrMoveFile(src_path, dest_path, options, mode);
  82. }
  83. base::File::Error ObfuscatedFileUtilDiskDelegate::DeleteFile(
  84. const base::FilePath& path) {
  85. return NativeFileUtil::DeleteFile(path);
  86. }
  87. } // namespace storage