| 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/remove_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/remove_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/file_system/operation_observer.h" | 10 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 DCHECK(entry_proto.get()); | 60 DCHECK(entry_proto.get()); |
| 61 | 61 |
| 62 // The edit URL can be empty for some reason. | 62 // The edit URL can be empty for some reason. |
| 63 if (entry_proto->edit_url().empty()) { | 63 if (entry_proto->edit_url().empty()) { |
| 64 callback.Run(DRIVE_FILE_ERROR_NOT_FOUND); | 64 callback.Run(DRIVE_FILE_ERROR_NOT_FOUND); |
| 65 return; | 65 return; |
| 66 } | 66 } |
| 67 | 67 |
| 68 drive_service_->DeleteDocument( | 68 drive_service_->DeleteDocument( |
| 69 GURL(entry_proto->edit_url()), | 69 GURL(entry_proto->edit_url()), |
| 70 std::string(), // ETag |
| 70 base::Bind(&RemoveOperation::RemoveResourceLocally, | 71 base::Bind(&RemoveOperation::RemoveResourceLocally, |
| 71 weak_ptr_factory_.GetWeakPtr(), | 72 weak_ptr_factory_.GetWeakPtr(), |
| 72 callback, | 73 callback, |
| 73 entry_proto->resource_id())); | 74 entry_proto->resource_id())); |
| 74 } | 75 } |
| 75 | 76 |
| 76 void RemoveOperation::RemoveResourceLocally( | 77 void RemoveOperation::RemoveResourceLocally( |
| 77 const FileOperationCallback& callback, | 78 const FileOperationCallback& callback, |
| 78 const std::string& resource_id, | 79 const std::string& resource_id, |
| 79 gdata::GDataErrorCode status, | 80 gdata::GDataErrorCode status, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 102 const FilePath& directory_path) { | 103 const FilePath& directory_path) { |
| 103 if (error == DRIVE_FILE_OK) | 104 if (error == DRIVE_FILE_OK) |
| 104 observer_->OnDirectoryChangedByOperation(directory_path); | 105 observer_->OnDirectoryChangedByOperation(directory_path); |
| 105 | 106 |
| 106 if (!callback.is_null()) | 107 if (!callback.is_null()) |
| 107 callback.Run(error); | 108 callback.Run(error); |
| 108 } | 109 } |
| 109 | 110 |
| 110 } // namespace file_system | 111 } // namespace file_system |
| 111 } // namespace drive | 112 } // namespace drive |
| OLD | NEW |