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

Unified Diff: webkit/fileapi/fileapi_file_util.cc

Issue 7470037: [Refactor] to rename and re-layer the file_util stack layers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed for ChromeOS again. Created 9 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 side-by-side diff with in-line comments
Download patch
Index: webkit/fileapi/fileapi_file_util.cc
diff --git a/webkit/fileapi/file_system_file_util.cc b/webkit/fileapi/fileapi_file_util.cc
similarity index 54%
rename from webkit/fileapi/file_system_file_util.cc
rename to webkit/fileapi/fileapi_file_util.cc
index 3600a8fd414dc8a13e47e7c19c159f87dd4a439f..f9cd93daf9c30710f935be9bd73b0baae831d432 100644
--- a/webkit/fileapi/file_system_file_util.cc
+++ b/webkit/fileapi/fileapi_file_util.cc
@@ -2,12 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/fileapi/file_system_file_util.h"
+#include "webkit/fileapi/fileapi_file_util.h"
#include <stack>
-#include <vector>
-#include "base/file_util_proxy.h"
#include "base/memory/scoped_ptr.h"
#include "webkit/fileapi/file_system_operation_context.h"
@@ -17,7 +15,7 @@ namespace {
// This assumes that the root exists.
bool ParentExists(FileSystemOperationContext* context,
- FileSystemFileUtil* file_util, const FilePath& file_path) {
+ FileApiFileUtil* file_util, const FilePath& file_path) {
// If file_path is in the root, file_path.DirName() will be ".",
// since we use paths with no leading '/'.
FilePath parent = file_path.DirName();
@@ -28,139 +26,17 @@ bool ParentExists(FileSystemOperationContext* context,
} // namespace
-PlatformFileError FileSystemFileUtil::CreateOrOpen(
- FileSystemOperationContext* unused,
- const FilePath& file_path, int file_flags,
- PlatformFile* file_handle, bool* created) {
- if (!file_util::DirectoryExists(file_path.DirName())) {
- // If its parent does not exist, should return NOT_FOUND error.
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
- }
- PlatformFileError error_code = base::PLATFORM_FILE_OK;
- *file_handle = base::CreatePlatformFile(file_path, file_flags,
- created, &error_code);
- return error_code;
-}
-
-PlatformFileError FileSystemFileUtil::Close(
- FileSystemOperationContext* unused,
- PlatformFile file_handle) {
- if (!base::ClosePlatformFile(file_handle))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
-}
-
-PlatformFileError FileSystemFileUtil::EnsureFileExists(
- FileSystemOperationContext* unused,
- const FilePath& file_path,
- bool* created) {
- if (!file_util::DirectoryExists(file_path.DirName()))
- // If its parent does not exist, should return NOT_FOUND error.
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
- PlatformFileError error_code = base::PLATFORM_FILE_OK;
- // Tries to create the |file_path| exclusively. This should fail
- // with base::PLATFORM_FILE_ERROR_EXISTS if the path already exists.
- PlatformFile handle = base::CreatePlatformFile(
- file_path,
- base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_READ,
- created, &error_code);
- if (error_code == base::PLATFORM_FILE_ERROR_EXISTS) {
- // Make sure created_ is false.
- if (created)
- *created = false;
- error_code = base::PLATFORM_FILE_OK;
- }
- if (handle != base::kInvalidPlatformFileValue)
- base::ClosePlatformFile(handle);
- return error_code;
-}
-
-PlatformFileError FileSystemFileUtil::GetLocalFilePath(
- FileSystemOperationContext* context,
- const FilePath& virtual_path,
- FilePath* local_path) {
- *local_path = virtual_path;
- return base::PLATFORM_FILE_OK;
-}
-
-PlatformFileError FileSystemFileUtil::GetFileInfo(
- FileSystemOperationContext* unused,
- const FilePath& file_path,
- base::PlatformFileInfo* file_info,
- FilePath* platform_file_path) {
- if (!file_util::PathExists(file_path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
- // TODO(rkc): Fix this hack once we have refactored file_util to handle
- // symlinks correctly.
- // http://code.google.com/p/chromium-os/issues/detail?id=15948
- if (file_util::IsLink(file_path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
- if (!file_util::GetFileInfo(file_path, file_info))
- return base::PLATFORM_FILE_ERROR_FAILED;
- *platform_file_path = file_path;
- return base::PLATFORM_FILE_OK;
+FileApiFileUtil::FileApiFileUtil() {
}
-PlatformFileError FileSystemFileUtil::ReadDirectory(
- FileSystemOperationContext* unused,
- const FilePath& file_path,
- std::vector<base::FileUtilProxy::Entry>* entries) {
- // TODO(kkanetkar): Implement directory read in multiple chunks.
- if (!file_util::DirectoryExists(file_path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
-
- file_util::FileEnumerator file_enum(
- file_path, false, static_cast<file_util::FileEnumerator::FileType>(
- file_util::FileEnumerator::FILES |
- file_util::FileEnumerator::DIRECTORIES));
- FilePath current;
- while (!(current = file_enum.Next()).empty()) {
- base::FileUtilProxy::Entry entry;
- file_util::FileEnumerator::FindInfo info;
- file_enum.GetFindInfo(&info);
- entry.is_directory = file_enum.IsDirectory(info);
- // This will just give the entry's name instead of entire path
- // if we use current.value().
- entry.name = file_util::FileEnumerator::GetFilename(info).value();
- entry.size = file_util::FileEnumerator::GetFilesize(info);
- entry.last_modified_time =
- file_util::FileEnumerator::GetLastModifiedTime(info);
- // TODO(rkc): Fix this also once we've refactored file_util
- // http://code.google.com/p/chromium-os/issues/detail?id=15948
- // This currently just prevents a file from showing up at all
- // if it's a link, hence preventing arbitary 'read' exploits.
- if (!file_util::IsLink(file_path.Append(entry.name)))
- entries->push_back(entry);
- }
- return base::PLATFORM_FILE_OK;
+FileApiFileUtil::FileApiFileUtil(FileApiFileUtil* underlying_file_util)
+ : underlying_file_util_(underlying_file_util) {
}
-PlatformFileError FileSystemFileUtil::CreateDirectory(
- FileSystemOperationContext* fs_context,
- const FilePath& file_path,
- bool exclusive,
- bool recursive) {
- if (fs_context->do_not_write_actually())
- return base::PLATFORM_FILE_OK;
-
- // If parent dir of file doesn't exist.
- if (!recursive && !file_util::PathExists(file_path.DirName()))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
-
- bool path_exists = file_util::PathExists(file_path);
- if (exclusive && path_exists)
- return base::PLATFORM_FILE_ERROR_EXISTS;
-
- // If file exists at the path.
- if (path_exists && !file_util::DirectoryExists(file_path))
- return base::PLATFORM_FILE_ERROR_EXISTS;
-
- if (!file_util::CreateDirectory(file_path))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
+FileApiFileUtil::~FileApiFileUtil() {
}
-PlatformFileError FileSystemFileUtil::Copy(
+PlatformFileError FileApiFileUtil::Copy(
FileSystemOperationContext* context,
const FilePath& src_file_path,
const FilePath& dest_file_path) {
@@ -178,7 +54,7 @@ PlatformFileError FileSystemFileUtil::Copy(
true /* copy */);
}
-PlatformFileError FileSystemFileUtil::Move(
+PlatformFileError FileApiFileUtil::Move(
FileSystemOperationContext* context,
const FilePath& src_file_path,
const FilePath& dest_file_path) {
@@ -197,7 +73,7 @@ PlatformFileError FileSystemFileUtil::Move(
false /* copy */);
}
-PlatformFileError FileSystemFileUtil::Delete(
+PlatformFileError FileApiFileUtil::Delete(
FileSystemOperationContext* context,
const FilePath& file_path,
bool recursive) {
@@ -211,51 +87,18 @@ PlatformFileError FileSystemFileUtil::Delete(
}
}
-PlatformFileError FileSystemFileUtil::Touch(
- FileSystemOperationContext* unused,
- const FilePath& file_path,
- const base::Time& last_access_time,
- const base::Time& last_modified_time) {
- if (!file_util::TouchFile(
- file_path, last_access_time, last_modified_time))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
-}
-
-PlatformFileError FileSystemFileUtil::Truncate(
- FileSystemOperationContext* unused,
- const FilePath& file_path,
- int64 length) {
- PlatformFileError error_code(base::PLATFORM_FILE_ERROR_FAILED);
- PlatformFile file =
- base::CreatePlatformFile(
- file_path,
- base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
- NULL,
- &error_code);
- if (error_code != base::PLATFORM_FILE_OK) {
- return error_code;
- }
- DCHECK_NE(base::kInvalidPlatformFileValue, file);
- if (!base::TruncatePlatformFile(file, length))
- error_code = base::PLATFORM_FILE_ERROR_FAILED;
- base::ClosePlatformFile(file);
- return error_code;
-}
-
PlatformFileError
-FileSystemFileUtil::PerformCommonCheckAndPreparationForMoveAndCopy(
+FileApiFileUtil::PerformCommonCheckAndPreparationForMoveAndCopy(
FileSystemOperationContext* context,
const FilePath& src_file_path,
const FilePath& dest_file_path) {
bool same_file_system =
(context->src_origin_url() == context->dest_origin_url()) &&
(context->src_type() == context->dest_type());
- FileSystemFileUtil* dest_util = context->dest_file_system_file_util();
+ FileApiFileUtil* dest_util = context->dest_file_util();
DCHECK(dest_util);
if (same_file_system)
- DCHECK(context->src_file_system_file_util() ==
- context->dest_file_system_file_util());
+ DCHECK(context->src_file_util() == context->dest_file_util());
// All the single-path virtual FSFU methods expect the context information
// to be in the src_* variables, not the dest_* variables, so we have to
// make a new context if we want to call them on the dest_file_path.
@@ -313,35 +156,12 @@ FileSystemFileUtil::PerformCommonCheckAndPreparationForMoveAndCopy(
return base::PLATFORM_FILE_OK;
}
-PlatformFileError FileSystemFileUtil::CopyOrMoveFile(
- FileSystemOperationContext* unused,
- const FilePath& src_file_path,
- const FilePath& dest_file_path,
- bool copy) {
- if (copy) {
- if (file_util::CopyFile(src_file_path, dest_file_path))
- return base::PLATFORM_FILE_OK;
- } else {
- DCHECK(!file_util::DirectoryExists(src_file_path));
- if (file_util::Move(src_file_path, dest_file_path))
- return base::PLATFORM_FILE_OK;
- }
- return base::PLATFORM_FILE_ERROR_FAILED;
-}
-
-PlatformFileError FileSystemFileUtil::CopyInForeignFile(
- FileSystemOperationContext* context,
- const FilePath& src_file_path,
- const FilePath& dest_file_path) {
- return CopyOrMoveFile(context, src_file_path, dest_file_path, true);
-}
-
-PlatformFileError FileSystemFileUtil::CopyOrMoveDirectory(
+PlatformFileError FileApiFileUtil::CopyOrMoveDirectory(
FileSystemOperationContext* context,
const FilePath& src_file_path,
const FilePath& dest_file_path,
bool copy) {
- FileSystemFileUtil* dest_util = context->dest_file_system_file_util();
+ FileApiFileUtil* dest_util = context->dest_file_util();
scoped_ptr<FileSystemOperationContext> dest_context(
context->CreateInheritedContextForDest());
@@ -397,7 +217,7 @@ PlatformFileError FileSystemFileUtil::CopyOrMoveDirectory(
return base::PLATFORM_FILE_OK;
}
-PlatformFileError FileSystemFileUtil::CopyOrMoveFileHelper(
+PlatformFileError FileApiFileUtil::CopyOrMoveFileHelper(
FileSystemOperationContext* context,
const FilePath& src_file_path,
const FilePath& dest_file_path,
@@ -405,8 +225,7 @@ PlatformFileError FileSystemFileUtil::CopyOrMoveFileHelper(
// CopyOrMoveFile here is the virtual overridden member function.
if ((context->src_origin_url() == context->dest_origin_url()) &&
(context->src_type() == context->dest_type())) {
- DCHECK(context->src_file_system_file_util() ==
- context->dest_file_system_file_util());
+ DCHECK(context->src_file_util() == context->dest_file_util());
return CopyOrMoveFile(context, src_file_path, dest_file_path, copy);
}
base::PlatformFileInfo file_info;
@@ -417,46 +236,15 @@ PlatformFileError FileSystemFileUtil::CopyOrMoveFileHelper(
if (error_code != base::PLATFORM_FILE_OK)
return error_code;
- DCHECK(context->dest_file_system_file_util());
- error_code = context->dest_file_system_file_util()->CopyInForeignFile(
+ DCHECK(context->dest_file_util());
+ error_code = context->dest_file_util()->CopyInForeignFile(
context, platform_file_path, dest_file_path);
if (copy || error_code != base::PLATFORM_FILE_OK)
return error_code;
return DeleteFile(context, src_file_path);
}
-
-PlatformFileError FileSystemFileUtil::DeleteFile(
- FileSystemOperationContext* unused,
- const FilePath& file_path) {
- if (!file_util::PathExists(file_path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
- if (file_util::DirectoryExists(file_path))
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
- if (!file_util::Delete(file_path, false))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
-}
-
-PlatformFileError FileSystemFileUtil::DeleteSingleDirectory(
- FileSystemOperationContext* unused,
- const FilePath& file_path) {
- if (!file_util::PathExists(file_path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
- if (!file_util::DirectoryExists(file_path)) {
- // TODO(dmikurube): Check if this error code is appropriate.
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
- }
- if (!file_util::IsDirectoryEmpty(file_path)) {
- // TODO(dmikurube): Check if this error code is appropriate.
- return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
- }
- if (!file_util::Delete(file_path, false))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
-}
-
-PlatformFileError FileSystemFileUtil::DeleteDirectoryRecursive(
+PlatformFileError FileApiFileUtil::DeleteDirectoryRecursive(
FileSystemOperationContext* context,
const FilePath& file_path) {
scoped_ptr<AbstractFileEnumerator> file_enum(
@@ -498,60 +286,212 @@ PlatformFileError FileSystemFileUtil::DeleteDirectoryRecursive(
return DeleteSingleDirectory(context, file_path);
}
-bool FileSystemFileUtil::PathExists(
- FileSystemOperationContext* unused,
- const FilePath& file_path) {
- return file_util::PathExists(file_path);
+PlatformFileError FileApiFileUtil::CreateOrOpen(
ericu 2011/08/22 17:59:37 It's good for implementations of methods to match
Dai Mikurube (NOT FULLTIME) 2011/08/24 11:57:30 Agreed, and reordered the functions.
+ FileSystemOperationContext* context,
+ const FilePath& file_path, int file_flags,
+ PlatformFile* file_handle, bool* created) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->CreateOrOpen(
+ context, file_path, file_flags, file_handle, created);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
}
-bool FileSystemFileUtil::DirectoryExists(
- FileSystemOperationContext* unused,
- const FilePath& file_path) {
- return file_util::DirectoryExists(file_path);
+PlatformFileError FileApiFileUtil::Close(
+ FileSystemOperationContext* context,
+ PlatformFile file_handle) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->Close(context, file_handle);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
}
-bool FileSystemFileUtil::IsDirectoryEmpty(
- FileSystemOperationContext* unused,
- const FilePath& file_path) {
- return file_util::IsDirectoryEmpty(file_path);
+PlatformFileError FileApiFileUtil::EnsureFileExists(
+ FileSystemOperationContext* context,
+ const FilePath& file_path,
+ bool* created) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->EnsureFileExists(context, file_path, created);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
+}
+
+PlatformFileError FileApiFileUtil::GetLocalFilePath(
+ FileSystemOperationContext* context,
+ const FilePath& virtual_path,
+ FilePath* local_path) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->GetLocalFilePath(
+ context, virtual_path, local_path);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
ericu 2011/08/22 17:59:37 s/it has/they have/g
Dai Mikurube (NOT FULLTIME) 2011/08/24 11:57:30 Done.
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
+}
+
+PlatformFileError FileApiFileUtil::GetFileInfo(
+ FileSystemOperationContext* context,
+ const FilePath& file_path,
+ base::PlatformFileInfo* file_info,
+ FilePath* platform_file_path) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->GetFileInfo(
+ context, file_path, file_info, platform_file_path);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
+}
+
+PlatformFileError FileApiFileUtil::ReadDirectory(
+ FileSystemOperationContext* context,
+ const FilePath& file_path,
+ std::vector<base::FileUtilProxy::Entry>* entries) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->ReadDirectory(context, file_path, entries);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
+}
+
+PlatformFileError FileApiFileUtil::CreateDirectory(
+ FileSystemOperationContext* context,
+ const FilePath& file_path,
+ bool exclusive,
+ bool recursive) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->CreateDirectory(
+ context, file_path, exclusive, recursive);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
+}
+
+PlatformFileError FileApiFileUtil::Touch(
+ FileSystemOperationContext* context,
+ const FilePath& file_path,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->Touch(
+ context, file_path, last_access_time, last_modified_time);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
}
-class FileSystemFileEnumerator
- : public FileSystemFileUtil::AbstractFileEnumerator {
- public:
- FileSystemFileEnumerator(const FilePath& root_path,
- bool recursive,
- file_util::FileEnumerator::FileType file_type)
- : file_enum_(root_path, recursive, file_type) {
+PlatformFileError FileApiFileUtil::Truncate(
+ FileSystemOperationContext* context,
+ const FilePath& file_path,
+ int64 length) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->Truncate(context, file_path, length);
}
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
+}
- ~FileSystemFileEnumerator() {}
+PlatformFileError FileApiFileUtil::CopyOrMoveFile(
+ FileSystemOperationContext* context,
+ const FilePath& src_file_path,
+ const FilePath& dest_file_path,
+ bool copy) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->CopyOrMoveFile(
+ context, src_file_path, dest_file_path, copy);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
+}
- virtual FilePath Next();
- virtual bool IsDirectory();
+PlatformFileError FileApiFileUtil::CopyInForeignFile(
+ FileSystemOperationContext* context,
+ const FilePath& src_file_path,
+ const FilePath& dest_file_path) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->CopyInForeignFile(
+ context, src_file_path, dest_file_path);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
+}
- private:
- file_util::FileEnumerator file_enum_;
-};
+PlatformFileError FileApiFileUtil::DeleteFile(
+ FileSystemOperationContext* context,
+ const FilePath& file_path) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->DeleteFile(context, file_path);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
+}
+
+PlatformFileError FileApiFileUtil::DeleteSingleDirectory(
+ FileSystemOperationContext* context,
+ const FilePath& file_path) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->DeleteSingleDirectory(context, file_path);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return base::PLATFORM_FILE_ERROR_FAILED;
+}
+
+bool FileApiFileUtil::PathExists(
+ FileSystemOperationContext* context,
+ const FilePath& file_path) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->PathExists(context, file_path);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return false;
+}
-FilePath FileSystemFileEnumerator::Next() {
- return file_enum_.Next();
+bool FileApiFileUtil::DirectoryExists(
+ FileSystemOperationContext* context,
+ const FilePath& file_path) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->DirectoryExists(context, file_path);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return false;
}
-bool FileSystemFileEnumerator::IsDirectory() {
- file_util::FileEnumerator::FindInfo file_util_info;
- file_enum_.GetFindInfo(&file_util_info);
- return file_util::FileEnumerator::IsDirectory(file_util_info);
+bool FileApiFileUtil::IsDirectoryEmpty(
+ FileSystemOperationContext* context,
+ const FilePath& file_path) {
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->IsDirectoryEmpty(context, file_path);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return false;
}
-FileSystemFileUtil::AbstractFileEnumerator*
-FileSystemFileUtil::CreateFileEnumerator(
- FileSystemOperationContext* unused,
+FileApiFileUtil::AbstractFileEnumerator* FileApiFileUtil::CreateFileEnumerator(
+ FileSystemOperationContext* context,
const FilePath& root_path) {
- return new FileSystemFileEnumerator(
- root_path, true, static_cast<file_util::FileEnumerator::FileType>(
- file_util::FileEnumerator::FILES |
- file_util::FileEnumerator::DIRECTORIES));
+ if (underlying_file_util_.get()) {
+ return underlying_file_util_->CreateFileEnumerator(context, root_path);
+ }
+ NOTREACHED() << "Subclasses must provide implementation if it has no"
+ << "underlying_file_util";
+ return NULL;
}
} // namespace fileapi

Powered by Google App Engine
This is Rietveld 408576698