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/file_system/operation_observer.h" | 8 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
9 #include "chrome/browser/chromeos/drive/file_system_util.h" | 9 #include "chrome/browser/chromeos/drive/file_system_util.h" |
10 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 10 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 metadata_->MoveEntryToDirectoryOnUIThread(src_path, dest_dir_path, callback); | 206 metadata_->MoveEntryToDirectoryOnUIThread(src_path, dest_dir_path, callback); |
207 } | 207 } |
208 | 208 |
209 void MoveOperation::RemoveFromDirectory( | 209 void MoveOperation::RemoveFromDirectory( |
210 const std::string& resource_id, | 210 const std::string& resource_id, |
211 const std::string& directory_resource_id, | 211 const std::string& directory_resource_id, |
212 const FileOperationCallback& callback) { | 212 const FileOperationCallback& callback) { |
213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
214 | 214 |
| 215 // Moving files out from "drive/other" special folder for storing orphan files |
| 216 // has no meaning in the server. Just skip the step. |
| 217 if (util::IsSpecialResourceId(directory_resource_id)) { |
| 218 callback.Run(FILE_ERROR_OK); |
| 219 return; |
| 220 } |
| 221 |
215 scheduler_->RemoveResourceFromDirectory( | 222 scheduler_->RemoveResourceFromDirectory( |
216 directory_resource_id, | 223 directory_resource_id, |
217 resource_id, | 224 resource_id, |
218 base::Bind(&MoveOperation::RemoveFromDirectoryCompleted, | 225 base::Bind(&MoveOperation::RemoveFromDirectoryCompleted, |
219 weak_ptr_factory_.GetWeakPtr(), | 226 weak_ptr_factory_.GetWeakPtr(), |
220 callback)); | 227 callback)); |
221 } | 228 } |
222 | 229 |
223 void MoveOperation::RemoveFromDirectoryCompleted( | 230 void MoveOperation::RemoveFromDirectoryCompleted( |
224 const FileOperationCallback& callback, | 231 const FileOperationCallback& callback, |
225 google_apis::GDataErrorCode status) { | 232 google_apis::GDataErrorCode status) { |
226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 233 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
227 callback.Run(util::GDataToFileError(status)); | 234 callback.Run(util::GDataToFileError(status)); |
228 } | 235 } |
229 | 236 |
230 } // namespace file_system | 237 } // namespace file_system |
231 } // namespace drive | 238 } // namespace drive |
OLD | NEW |