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

Unified Diff: chrome/browser/chromeos/drive/file_system/move_operation.cc

Issue 12039005: drive: Deal with the root directory in the same way as others in MoveOperation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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: chrome/browser/chromeos/drive/file_system/move_operation.cc
diff --git a/chrome/browser/chromeos/drive/file_system/move_operation.cc b/chrome/browser/chromeos/drive/file_system/move_operation.cc
index c9b686b8ea6404382cb84b890fffe953d721c79b..0525c87c55976fab55321ff40472fff941efbdfe 100644
--- a/chrome/browser/chromeos/drive/file_system/move_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/move_operation.cc
@@ -93,13 +93,13 @@ void MoveOperation::MoveAfterGetEntryInfoPair(
// effectively moves the file from the root directory to the parent
// directory of |dest_file_path|.
const FileMoveCallback add_file_to_directory_callback =
- base::Bind(&MoveOperation::MoveEntryFromRootDirectory,
+ base::Bind(&MoveOperation::AddEntryToDirectory,
weak_ptr_factory_.GetWeakPtr(),
dest_parent_path,
callback);
const FileMoveCallback remove_file_from_directory_callback =
- base::Bind(&MoveOperation::RemoveEntryFromNonRootDirectory,
+ base::Bind(&MoveOperation::RemoveEntryFromDirectory,
weak_ptr_factory_.GetWeakPtr(),
add_file_to_directory_callback);
@@ -206,30 +206,23 @@ void MoveOperation::RenameEntryLocally(
callback));
}
-void MoveOperation::RemoveEntryFromNonRootDirectory(
+void MoveOperation::RemoveEntryFromDirectory(
const FileMoveCallback& callback,
DriveFileError error,
const FilePath& file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- const FilePath dir_path = file_path.DirName();
- // Return if there is an error or |dir_path| is the root directory.
- if (error != DRIVE_FILE_OK || dir_path == FilePath(kDriveRootDirectory)) {
- callback.Run(error, file_path);
- return;
- }
-
metadata_->GetEntryInfoPairByPaths(
file_path,
- dir_path,
+ file_path.DirName(),
base::Bind(
- &MoveOperation::RemoveEntryFromNonRootDirectoryAfterEntryInfoPair,
+ &MoveOperation::RemoveEntryFromDirectoryAfterEntryInfoPair,
weak_ptr_factory_.GetWeakPtr(),
callback));
}
-void MoveOperation::RemoveEntryFromNonRootDirectoryAfterEntryInfoPair(
+void MoveOperation::RemoveEntryFromDirectoryAfterEntryInfoPair(
const FileMoveCallback& callback,
scoped_ptr<EntryInfoPairResult> result) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -268,34 +261,25 @@ void MoveOperation::RemoveEntryFromNonRootDirectoryAfterEntryInfoPair(
// TODO(zork): Share with CopyOperation.
// See: crbug.com/150050
-void MoveOperation::MoveEntryFromRootDirectory(
- const FilePath& directory_path,
- const FileOperationCallback& callback,
- DriveFileError error,
- const FilePath& file_path) {
+void MoveOperation::AddEntryToDirectory(const FilePath& directory_path,
+ const FileOperationCallback& callback,
+ DriveFileError error,
+ const FilePath& file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- DCHECK_EQ(kDriveRootDirectory, file_path.DirName().value());
-
- // Return if there is an error or |dir_path| is the root directory.
- if (error != DRIVE_FILE_OK ||
- directory_path == FilePath(kDriveRootDirectory)) {
- callback.Run(error);
- return;
- }
metadata_->GetEntryInfoPairByPaths(
file_path,
directory_path,
base::Bind(
- &MoveOperation::MoveEntryFromRootDirectoryAfterGetEntryInfoPair,
+ &MoveOperation::AddEntryToDirectoryAfterGetEntryInfoPair,
weak_ptr_factory_.GetWeakPtr(),
callback));
}
// TODO(zork): Share with CopyOperation.
// See: crbug.com/150050
-void MoveOperation::MoveEntryFromRootDirectoryAfterGetEntryInfoPair(
+void MoveOperation::AddEntryToDirectoryAfterGetEntryInfoPair(
const FileOperationCallback& callback,
scoped_ptr<EntryInfoPairResult> result) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

Powered by Google App Engine
This is Rietveld 408576698