summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-25 06:19:44 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-25 06:19:44 +0000
commit0a5cb663cfc480553fdff8656cb0374cf03cb683 (patch)
treeca9d06ad78384b8051b5439123aa6f0293c53851
parent1ca29cd15cb9042fde066c5f7b8bf5bf3a34ac0a (diff)
downloadchromium_src-0a5cb663cfc480553fdff8656cb0374cf03cb683.zip
chromium_src-0a5cb663cfc480553fdff8656cb0374cf03cb683.tar.gz
chromium_src-0a5cb663cfc480553fdff8656cb0374cf03cb683.tar.bz2
chromeos: Stop returning private data type from DriveResourceMetadata methods
Methods working on the blocking pool is going to be public. BUG=231222 TEST=unit_tests Review URL: https://chromiumcodereview.appspot.com/13959010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196338 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/drive/drive_resource_metadata.cc327
-rw-r--r--chrome/browser/chromeos/drive/drive_resource_metadata.h36
2 files changed, 179 insertions, 184 deletions
diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.cc b/chrome/browser/chromeos/drive/drive_resource_metadata.cc
index 0897631..0d033b3 100644
--- a/chrome/browser/chromeos/drive/drive_resource_metadata.cc
+++ b/chrome/browser/chromeos/drive/drive_resource_metadata.cc
@@ -52,18 +52,69 @@ bool EnoughDiskSpaceIsAvailableForDBOperation(const base::FilePath& path) {
}
// Runs |callback| with arguments.
+void RunGetEntryInfoCallback(const GetEntryInfoCallback& callback,
+ scoped_ptr<DriveEntryProto> entry,
+ FileError error) {
+ DCHECK(!callback.is_null());
+
+ if (error != FILE_ERROR_OK)
+ entry.reset();
+ callback.Run(error, entry.Pass());
+}
+
+// Runs |callback| with arguments.
void RunGetEntryInfoWithFilePathCallback(
const GetEntryInfoWithFilePathCallback& callback,
base::FilePath* path,
scoped_ptr<DriveEntryProto> entry,
FileError error) {
DCHECK(!callback.is_null());
+ DCHECK(path);
if (error != FILE_ERROR_OK)
entry.reset();
callback.Run(error, *path, entry.Pass());
}
+// Runs |callback| with arguments.
+void RunReadDirectoryCallback(const ReadDirectoryCallback& callback,
+ scoped_ptr<DriveEntryProtoVector> entries,
+ FileError error) {
+ DCHECK(!callback.is_null());
+
+ if (error != FILE_ERROR_OK)
+ entries.reset();
+ callback.Run(error, entries.Pass());
+}
+
+// Runs |callback| with arguments.
+void RunFileMoveCallback(const FileMoveCallback& callback,
+ base::FilePath* path,
+ FileError error) {
+ DCHECK(!callback.is_null());
+ DCHECK(path);
+
+ callback.Run(error, *path);
+}
+
+// Helper function to run tasks with FileMoveCallback.
+void PostFileMoveTask(
+ base::TaskRunner* task_runner,
+ const base::Callback<FileError(base::FilePath* out_file_path)>& task,
+ const FileMoveCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(!task.is_null());
+ DCHECK(!callback.is_null());
+
+ base::FilePath* file_path = new base::FilePath;
+
+ base::PostTaskAndReplyWithResult(
+ task_runner,
+ FROM_HERE,
+ base::Bind(task, file_path),
+ base::Bind(&RunFileMoveCallback, callback, base::Owned(file_path)));
+}
+
} // namespace
std::string DirectoryFetchInfo::ToString() const {
@@ -83,68 +134,6 @@ EntryInfoPairResult::EntryInfoPairResult() {
EntryInfoPairResult::~EntryInfoPairResult() {
}
-// Struct to hold result values passed to FileMoveCallback.
-struct DriveResourceMetadata::FileMoveResult {
- FileMoveResult(FileError error, const base::FilePath& path)
- : error(error),
- path(path) {}
-
- explicit FileMoveResult(FileError error)
- : error(error) {}
-
- FileMoveResult() : error(FILE_ERROR_OK) {}
-
- // Runs GetEntryInfoCallback with the values stored in |result|.
- static void RunCallbackWithResult(const FileMoveCallback& callback,
- const FileMoveResult& result) {
- DCHECK(!callback.is_null());
- callback.Run(result.error, result.path);
- }
-
- FileError error;
- base::FilePath path;
-};
-
-// Struct to hold result values passed to GetEntryInfoCallback.
-struct DriveResourceMetadata::GetEntryInfoResult {
- GetEntryInfoResult(FileError error, scoped_ptr<DriveEntryProto> entry)
- : error(error),
- entry(entry.Pass()) {}
-
- explicit GetEntryInfoResult(FileError error)
- : error(error) {}
-
- // Runs GetEntryInfoCallback with the values stored in |result|.
- static void RunCallbackWithResult(const GetEntryInfoCallback& callback,
- scoped_ptr<GetEntryInfoResult> result) {
- DCHECK(!callback.is_null());
- DCHECK(result);
- callback.Run(result->error, result->entry.Pass());
- }
-
- FileError error;
- scoped_ptr<DriveEntryProto> entry;
-};
-
-// Struct to hold result values passed to ReadDirectoryCallback.
-struct DriveResourceMetadata::ReadDirectoryResult {
- ReadDirectoryResult(FileError error,
- scoped_ptr<DriveEntryProtoVector> entries)
- : error(error),
- entries(entries.Pass()) {}
-
- // Runs ReadDirectoryCallback with the values stored in |result|.
- static void RunCallbackWithResult(const ReadDirectoryCallback& callback,
- scoped_ptr<ReadDirectoryResult> result) {
- DCHECK(!callback.is_null());
- DCHECK(result);
- callback.Run(result->error, result->entries.Pass());
- }
-
- FileError error;
- scoped_ptr<DriveEntryProtoVector> entries;
-};
-
// DriveResourceMetadata class implementation.
DriveResourceMetadata::DriveResourceMetadata(
@@ -274,14 +263,12 @@ void DriveResourceMetadata::AddEntry(const DriveEntryProto& entry_proto,
const FileMoveCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- base::PostTaskAndReplyWithResult(
- blocking_task_runner_,
- FROM_HERE,
- base::Bind(&DriveResourceMetadata::AddEntryOnBlockingPool,
- base::Unretained(this),
- entry_proto),
- base::Bind(&FileMoveResult::RunCallbackWithResult,
- callback));
+
+ PostFileMoveTask(blocking_task_runner_,
+ base::Bind(&DriveResourceMetadata::AddEntryOnBlockingPool,
+ base::Unretained(this),
+ entry_proto),
+ callback);
}
void DriveResourceMetadata::MoveEntryToDirectory(
@@ -290,15 +277,14 @@ void DriveResourceMetadata::MoveEntryToDirectory(
const FileMoveCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- base::PostTaskAndReplyWithResult(
+
+ PostFileMoveTask(
blocking_task_runner_,
- FROM_HERE,
base::Bind(&DriveResourceMetadata::MoveEntryToDirectoryOnBlockingPool,
base::Unretained(this),
file_path,
directory_path),
- base::Bind(&FileMoveResult::RunCallbackWithResult,
- callback));
+ callback);
}
void DriveResourceMetadata::RenameEntry(const base::FilePath& file_path,
@@ -306,29 +292,25 @@ void DriveResourceMetadata::RenameEntry(const base::FilePath& file_path,
const FileMoveCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- base::PostTaskAndReplyWithResult(
- blocking_task_runner_,
- FROM_HERE,
- base::Bind(&DriveResourceMetadata::RenameEntryOnBlockingPool,
- base::Unretained(this),
- file_path,
- new_name),
- base::Bind(&FileMoveResult::RunCallbackWithResult,
- callback));
+
+ PostFileMoveTask(blocking_task_runner_,
+ base::Bind(&DriveResourceMetadata::RenameEntryOnBlockingPool,
+ base::Unretained(this),
+ file_path,
+ new_name),
+ callback);
}
void DriveResourceMetadata::RemoveEntry(const std::string& resource_id,
const FileMoveCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- base::PostTaskAndReplyWithResult(
- blocking_task_runner_,
- FROM_HERE,
- base::Bind(&DriveResourceMetadata::RemoveEntryOnBlockingPool,
- base::Unretained(this),
- resource_id),
- base::Bind(&FileMoveResult::RunCallbackWithResult,
- callback));
+
+ PostFileMoveTask(blocking_task_runner_,
+ base::Bind(&DriveResourceMetadata::RemoveEntryOnBlockingPool,
+ base::Unretained(this),
+ resource_id),
+ callback);
}
void DriveResourceMetadata::GetEntryInfoByResourceId(
@@ -359,14 +341,19 @@ void DriveResourceMetadata::GetEntryInfoByPath(
const GetEntryInfoCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
+
+ scoped_ptr<DriveEntryProto> entry(new DriveEntryProto);
+ DriveEntryProto* entry_ptr = entry.get();
base::PostTaskAndReplyWithResult(
blocking_task_runner_,
FROM_HERE,
base::Bind(&DriveResourceMetadata::GetEntryInfoByPathOnBlockingPool,
base::Unretained(this),
- file_path),
- base::Bind(&GetEntryInfoResult::RunCallbackWithResult,
- callback));
+ file_path,
+ entry_ptr),
+ base::Bind(&RunGetEntryInfoCallback,
+ callback,
+ base::Passed(&entry)));
}
void DriveResourceMetadata::ReadDirectoryByPath(
@@ -374,14 +361,19 @@ void DriveResourceMetadata::ReadDirectoryByPath(
const ReadDirectoryCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
+
+ scoped_ptr<DriveEntryProtoVector> entries(new DriveEntryProtoVector);
+ DriveEntryProtoVector* entries_ptr = entries.get();
base::PostTaskAndReplyWithResult(
blocking_task_runner_,
FROM_HERE,
base::Bind(&DriveResourceMetadata::ReadDirectoryByPathOnBlockingPool,
base::Unretained(this),
- file_path),
- base::Bind(&ReadDirectoryResult::RunCallbackWithResult,
- callback));
+ file_path,
+ entries_ptr),
+ base::Bind(&RunReadDirectoryCallback,
+ callback,
+ base::Passed(&entries)));
}
void DriveResourceMetadata::RefreshEntry(
@@ -413,15 +405,14 @@ void DriveResourceMetadata::RefreshDirectory(
const FileMoveCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- base::PostTaskAndReplyWithResult(
+
+ PostFileMoveTask(
blocking_task_runner_,
- FROM_HERE,
base::Bind(&DriveResourceMetadata::RefreshDirectoryOnBlockingPool,
base::Unretained(this),
directory_fetch_info,
entry_proto_map),
- base::Bind(&FileMoveResult::RunCallbackWithResult,
- callback));
+ callback);
}
void DriveResourceMetadata::GetChildDirectories(
@@ -480,35 +471,33 @@ FileError DriveResourceMetadata::SetLargestChangestampOnBlockingPool(
return FILE_ERROR_OK;
}
-DriveResourceMetadata::FileMoveResult
-DriveResourceMetadata::MoveEntryToDirectoryOnBlockingPool(
+FileError DriveResourceMetadata::MoveEntryToDirectoryOnBlockingPool(
const base::FilePath& file_path,
- const base::FilePath& directory_path) {
+ const base::FilePath& directory_path,
+ base::FilePath* out_file_path) {
DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread());
DCHECK(!directory_path.empty());
DCHECK(!file_path.empty());
if (!EnoughDiskSpaceIsAvailableForDBOperation(data_directory_path_))
- return FileMoveResult(FILE_ERROR_NO_SPACE);
+ return FILE_ERROR_NO_SPACE;
scoped_ptr<DriveEntryProto> entry = FindEntryByPathSync(file_path);
scoped_ptr<DriveEntryProto> destination = FindEntryByPathSync(directory_path);
if (!entry || !destination)
- return FileMoveResult(FILE_ERROR_NOT_FOUND);
+ return FILE_ERROR_NOT_FOUND;
if (!destination->file_info().is_directory())
- return FileMoveResult(FILE_ERROR_NOT_A_DIRECTORY);
+ return FILE_ERROR_NOT_A_DIRECTORY;
entry->set_parent_resource_id(destination->resource_id());
- base::FilePath result_file_path;
- FileError error = RefreshEntryOnBlockingPool(*entry, &result_file_path, NULL);
- return FileMoveResult(error, result_file_path);
+ return RefreshEntryOnBlockingPool(*entry, out_file_path, NULL);
}
-DriveResourceMetadata::FileMoveResult
-DriveResourceMetadata::RenameEntryOnBlockingPool(
+FileError DriveResourceMetadata::RenameEntryOnBlockingPool(
const base::FilePath& file_path,
- const std::string& new_name) {
+ const std::string& new_name,
+ base::FilePath* out_file_path) {
DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread());
DCHECK(!file_path.empty());
DCHECK(!new_name.empty());
@@ -516,42 +505,41 @@ DriveResourceMetadata::RenameEntryOnBlockingPool(
DVLOG(1) << "RenameEntry " << file_path.value() << " to " << new_name;
if (!EnoughDiskSpaceIsAvailableForDBOperation(data_directory_path_))
- return FileMoveResult(FILE_ERROR_NO_SPACE);
+ return FILE_ERROR_NO_SPACE;
scoped_ptr<DriveEntryProto> entry = FindEntryByPathSync(file_path);
if (!entry)
- return FileMoveResult(FILE_ERROR_NOT_FOUND);
+ return FILE_ERROR_NOT_FOUND;
if (base::FilePath::FromUTF8Unsafe(new_name) == file_path.BaseName())
- return FileMoveResult(FILE_ERROR_EXISTS);
+ return FILE_ERROR_EXISTS;
entry->set_title(new_name);
- base::FilePath result_file_path;
- FileError error = RefreshEntryOnBlockingPool(*entry, &result_file_path, NULL);
- return FileMoveResult(error, result_file_path);
+ return RefreshEntryOnBlockingPool(*entry, out_file_path, NULL);
}
-DriveResourceMetadata::FileMoveResult
-DriveResourceMetadata::RemoveEntryOnBlockingPool(
- const std::string& resource_id) {
+FileError DriveResourceMetadata::RemoveEntryOnBlockingPool(
+ const std::string& resource_id,
+ base::FilePath* out_file_path) {
DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread());
if (!EnoughDiskSpaceIsAvailableForDBOperation(data_directory_path_))
- return FileMoveResult(FILE_ERROR_NO_SPACE);
+ return FILE_ERROR_NO_SPACE;
// Disallow deletion of special entries "/drive" and "/drive/other".
if (util::IsSpecialResourceId(resource_id))
- return FileMoveResult(FILE_ERROR_ACCESS_DENIED);
+ return FILE_ERROR_ACCESS_DENIED;
scoped_ptr<DriveEntryProto> entry = storage_->GetEntry(resource_id);
if (!entry)
- return FileMoveResult(FILE_ERROR_NOT_FOUND);
+ return FILE_ERROR_NOT_FOUND;
if (!RemoveEntryRecursively(entry->resource_id()))
- return FileMoveResult(FILE_ERROR_FAILED);
+ return FILE_ERROR_FAILED;
- return FileMoveResult(FILE_ERROR_OK,
- GetFilePath(entry->parent_resource_id()));
+ if (out_file_path)
+ *out_file_path = GetFilePath(entry->parent_resource_id());
+ return FILE_ERROR_OK;
}
scoped_ptr<DriveEntryProto> DriveResourceMetadata::FindEntryByPathSync(
@@ -605,36 +593,35 @@ FileError DriveResourceMetadata::GetEntryInfoByResourceIdOnBlockingPool(
return FILE_ERROR_OK;
}
-scoped_ptr<DriveResourceMetadata::GetEntryInfoResult>
-DriveResourceMetadata::GetEntryInfoByPathOnBlockingPool(
- const base::FilePath& path) {
+FileError DriveResourceMetadata::GetEntryInfoByPathOnBlockingPool(
+ const base::FilePath& path,
+ DriveEntryProto* out_entry) {
DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread());
+ DCHECK(out_entry);
scoped_ptr<DriveEntryProto> entry = FindEntryByPathSync(path);
- FileError error = entry ? FILE_ERROR_OK : FILE_ERROR_NOT_FOUND;
+ if (!entry)
+ return FILE_ERROR_NOT_FOUND;
- return make_scoped_ptr(new GetEntryInfoResult(error, entry.Pass()));
+ *out_entry = *entry;
+ return FILE_ERROR_OK;
}
-scoped_ptr<DriveResourceMetadata::ReadDirectoryResult>
-DriveResourceMetadata::ReadDirectoryByPathOnBlockingPool(
- const base::FilePath& path) {
+FileError DriveResourceMetadata::ReadDirectoryByPathOnBlockingPool(
+ const base::FilePath& path,
+ DriveEntryProtoVector* out_entries) {
DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread());
-
- scoped_ptr<DriveEntryProtoVector> entries;
- FileError error = FILE_ERROR_FAILED;
+ DCHECK(out_entries);
scoped_ptr<DriveEntryProto> entry = FindEntryByPathSync(path);
- if (entry && entry->file_info().is_directory()) {
- entries = DirectoryChildrenToProtoVector(entry->resource_id());
- error = FILE_ERROR_OK;
- } else if (entry && !entry->file_info().is_directory()) {
- error = FILE_ERROR_NOT_A_DIRECTORY;
- } else {
- error = FILE_ERROR_NOT_FOUND;
- }
+ if (!entry)
+ return FILE_ERROR_NOT_FOUND;
+
+ if (!entry->file_info().is_directory())
+ return FILE_ERROR_NOT_A_DIRECTORY;
- return make_scoped_ptr(new ReadDirectoryResult(error, entries.Pass()));
+ DirectoryChildrenToProtoVector(entry->resource_id())->swap(*out_entries);
+ return FILE_ERROR_OK;
}
void DriveResourceMetadata::GetEntryInfoPairByPaths(
@@ -697,24 +684,24 @@ FileError DriveResourceMetadata::RefreshEntryOnBlockingPool(
return FILE_ERROR_OK;
}
-DriveResourceMetadata::FileMoveResult
-DriveResourceMetadata::RefreshDirectoryOnBlockingPool(
+FileError DriveResourceMetadata::RefreshDirectoryOnBlockingPool(
const DirectoryFetchInfo& directory_fetch_info,
- const DriveEntryProtoMap& entry_proto_map) {
+ const DriveEntryProtoMap& entry_proto_map,
+ base::FilePath* out_file_path) {
DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread());
DCHECK(!directory_fetch_info.empty());
if (!EnoughDiskSpaceIsAvailableForDBOperation(data_directory_path_))
- return FileMoveResult(FILE_ERROR_NO_SPACE);
+ return FILE_ERROR_NO_SPACE;
scoped_ptr<DriveEntryProto> directory = storage_->GetEntry(
directory_fetch_info.resource_id());
if (!directory)
- return FileMoveResult(FILE_ERROR_NOT_FOUND);
+ return FILE_ERROR_NOT_FOUND;
if (!directory->file_info().is_directory())
- return FileMoveResult(FILE_ERROR_NOT_A_DIRECTORY);
+ return FILE_ERROR_NOT_A_DIRECTORY;
directory->mutable_directory_specific_info()->set_changestamp(
directory_fetch_info.changestamp());
@@ -725,7 +712,7 @@ DriveResourceMetadata::RefreshDirectoryOnBlockingPool(
for (DriveEntryProtoMap::const_iterator it = entry_proto_map.begin();
it != entry_proto_map.end(); ++it) {
if (!EnoughDiskSpaceIsAvailableForDBOperation(data_directory_path_))
- return FileMoveResult(FILE_ERROR_NO_SPACE);
+ return FILE_ERROR_NO_SPACE;
const DriveEntryProto& entry_proto = it->second;
// Skip if the parent resource ID does not match. This is needed to
@@ -742,7 +729,7 @@ DriveResourceMetadata::RefreshDirectoryOnBlockingPool(
}
if (!PutEntryUnderDirectory(CreateEntryWithProperBaseName(entry_proto)))
- return FileMoveResult(FILE_ERROR_FAILED);
+ return FILE_ERROR_FAILED;
}
// Go through the existing entries and remove deleted entries.
@@ -750,40 +737,46 @@ DriveResourceMetadata::RefreshDirectoryOnBlockingPool(
DirectoryChildrenToProtoVector(directory->resource_id());
for (size_t i = 0; i < entries->size(); ++i) {
if (!EnoughDiskSpaceIsAvailableForDBOperation(data_directory_path_))
- return FileMoveResult(FILE_ERROR_NO_SPACE);
+ return FILE_ERROR_NO_SPACE;
const DriveEntryProto& entry_proto = entries->at(i);
if (entry_proto_map.count(entry_proto.resource_id()) == 0) {
if (!RemoveEntryRecursively(entry_proto.resource_id()))
- return FileMoveResult(FILE_ERROR_FAILED);
+ return FILE_ERROR_FAILED;
}
}
- return FileMoveResult(FILE_ERROR_OK, GetFilePath(directory->resource_id()));
+ if (out_file_path)
+ *out_file_path = GetFilePath(directory->resource_id());
+
+ return FILE_ERROR_OK;
}
-DriveResourceMetadata::FileMoveResult
-DriveResourceMetadata::AddEntryOnBlockingPool(
- const DriveEntryProto& entry_proto) {
+FileError DriveResourceMetadata::AddEntryOnBlockingPool(
+ const DriveEntryProto& entry_proto,
+ base::FilePath* out_file_path) {
DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread());
if (!EnoughDiskSpaceIsAvailableForDBOperation(data_directory_path_))
- return FileMoveResult(FILE_ERROR_NO_SPACE);
+ return FILE_ERROR_NO_SPACE;
scoped_ptr<DriveEntryProto> existing_entry =
storage_->GetEntry(entry_proto.resource_id());
if (existing_entry)
- return FileMoveResult(FILE_ERROR_EXISTS);
+ return FILE_ERROR_EXISTS;
scoped_ptr<DriveEntryProto> parent =
GetDirectory(entry_proto.parent_resource_id());
if (!parent)
- return FileMoveResult(FILE_ERROR_NOT_FOUND);
+ return FILE_ERROR_NOT_FOUND;
if (!PutEntryUnderDirectory(entry_proto))
- return FileMoveResult(FILE_ERROR_FAILED);
+ return FILE_ERROR_FAILED;
- return FileMoveResult(FILE_ERROR_OK, GetFilePath(entry_proto.resource_id()));
+ if (out_file_path)
+ *out_file_path = GetFilePath(entry_proto.resource_id());
+
+ return FILE_ERROR_OK;
}
scoped_ptr<DriveEntryProto> DriveResourceMetadata::GetDirectory(
diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.h b/chrome/browser/chromeos/drive/drive_resource_metadata.h
index 5446dee..d94c7cb 100644
--- a/chrome/browser/chromeos/drive/drive_resource_metadata.h
+++ b/chrome/browser/chromeos/drive/drive_resource_metadata.h
@@ -231,12 +231,8 @@ class DriveResourceMetadata {
const base::Closure& completion_callback);
private:
- struct FileMoveResult;
- struct GetEntryInfoResult;
- struct ReadDirectoryResult;
-
// Note: Use Destroy() to delete this object.
- virtual ~DriveResourceMetadata();
+ ~DriveResourceMetadata();
// Used to implement Initialize();
FileError InitializeOnBlockingPool() WARN_UNUSED_RESULT;
@@ -257,19 +253,23 @@ class DriveResourceMetadata {
FileError SetLargestChangestampOnBlockingPool(int64 value);
// Used to implement AddEntry().
- FileMoveResult AddEntryOnBlockingPool(const DriveEntryProto& entry_proto);
+ FileError AddEntryOnBlockingPool(const DriveEntryProto& entry_proto,
+ base::FilePath* out_file_path);
// Used to implement MoveEntryToDirectory().
- FileMoveResult MoveEntryToDirectoryOnBlockingPool(
+ FileError MoveEntryToDirectoryOnBlockingPool(
const base::FilePath& file_path,
- const base::FilePath& directory_path);
+ const base::FilePath& directory_path,
+ base::FilePath* out_file_path);
// Used to implement RenameEntry().
- FileMoveResult RenameEntryOnBlockingPool(const base::FilePath& file_path,
- const std::string& new_name);
+ FileError RenameEntryOnBlockingPool(const base::FilePath& file_path,
+ const std::string& new_name,
+ base::FilePath* out_file_path);
// Used to implement RemoveEntry().
- FileMoveResult RemoveEntryOnBlockingPool(const std::string& resource_id);
+ FileError RemoveEntryOnBlockingPool(const std::string& resource_id,
+ base::FilePath* out_file_path);
// Used to implement GetEntryInfoByResourceId().
FileError GetEntryInfoByResourceIdOnBlockingPool(
@@ -278,12 +278,13 @@ class DriveResourceMetadata {
DriveEntryProto* out_entry);
// Used to implement GetEntryInfoByPath().
- scoped_ptr<GetEntryInfoResult> GetEntryInfoByPathOnBlockingPool(
- const base::FilePath& file_path);
+ FileError GetEntryInfoByPathOnBlockingPool(const base::FilePath& file_path,
+ DriveEntryProto* out_entry);
// Used to implement ReadDirectoryByPath().
- scoped_ptr<ReadDirectoryResult> ReadDirectoryByPathOnBlockingPool(
- const base::FilePath& file_path);
+ FileError ReadDirectoryByPathOnBlockingPool(
+ const base::FilePath& file_path,
+ DriveEntryProtoVector* out_entries);
// Used to implement RefreshEntry().
FileError RefreshEntryOnBlockingPool(const DriveEntryProto& entry_proto,
@@ -291,9 +292,10 @@ class DriveResourceMetadata {
DriveEntryProto* out_entry);
// Used to implement RefreshDirectory().
- FileMoveResult RefreshDirectoryOnBlockingPool(
+ FileError RefreshDirectoryOnBlockingPool(
const DirectoryFetchInfo& directory_fetch_info,
- const DriveEntryProtoMap& entry_proto_map);
+ const DriveEntryProtoMap& entry_proto_map,
+ base::FilePath* out_file_path);
// Used to implement GetChildDirectories().
scoped_ptr<std::set<base::FilePath> > GetChildDirectoriesOnBlockingPool(