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 "chrome/browser/chromeos/drive/file_system/move_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/move_operation.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/drive/drive.pb.h" | 7 #include "chrome/browser/chromeos/drive/drive.pb.h" |
8 #include "chrome/browser/chromeos/drive/drive_cache.h" | 8 #include "chrome/browser/chromeos/drive/drive_cache.h" |
9 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 9 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
10 #include "chrome/browser/chromeos/drive/drive_files.h" | 10 #include "chrome/browser/chromeos/drive/drive_files.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 scoped_ptr<DriveEntryProto> dir_proto = result->second.proto.Pass(); | 247 scoped_ptr<DriveEntryProto> dir_proto = result->second.proto.Pass(); |
248 | 248 |
249 if (!dir_proto->file_info().is_directory()) { | 249 if (!dir_proto->file_info().is_directory()) { |
250 callback.Run(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, file_path); | 250 callback.Run(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, file_path); |
251 return; | 251 return; |
252 } | 252 } |
253 | 253 |
254 // The entry is moved to the root directory. | 254 // The entry is moved to the root directory. |
255 drive_service_->RemoveResourceFromDirectory( | 255 drive_service_->RemoveResourceFromDirectory( |
256 GURL(dir_proto->content_url()), | 256 GURL(dir_proto->content_url()), |
257 GURL(entry_proto->edit_url()), | |
258 entry_proto->resource_id(), | 257 entry_proto->resource_id(), |
259 base::Bind(&MoveOperation::MoveEntryToDirectory, | 258 base::Bind(&MoveOperation::MoveEntryToDirectory, |
260 weak_ptr_factory_.GetWeakPtr(), | 259 weak_ptr_factory_.GetWeakPtr(), |
261 file_path, | 260 file_path, |
262 FilePath(kDriveRootDirectory), | 261 FilePath(kDriveRootDirectory), |
263 base::Bind(&MoveOperation::NotifyAndRunFileMoveCallback, | 262 base::Bind(&MoveOperation::NotifyAndRunFileMoveCallback, |
264 weak_ptr_factory_.GetWeakPtr(), | 263 weak_ptr_factory_.GetWeakPtr(), |
265 callback))); | 264 callback))); |
266 } | 265 } |
267 | 266 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 DCHECK(!callback.is_null()); | 372 DCHECK(!callback.is_null()); |
374 | 373 |
375 if (error == DRIVE_FILE_OK) | 374 if (error == DRIVE_FILE_OK) |
376 observer_->OnDirectoryChangedByOperation(moved_file_path.DirName()); | 375 observer_->OnDirectoryChangedByOperation(moved_file_path.DirName()); |
377 | 376 |
378 callback.Run(error, moved_file_path); | 377 callback.Run(error, moved_file_path); |
379 } | 378 } |
380 | 379 |
381 } // namespace file_system | 380 } // namespace file_system |
382 } // namespace drive | 381 } // namespace drive |
OLD | NEW |