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 "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
8 #include "chrome/browser/chromeos/drive/drive.pb.h" | 8 #include "chrome/browser/chromeos/drive/drive.pb.h" |
9 #include "chrome/browser/chromeos/drive/file_cache.h" | 9 #include "chrome/browser/chromeos/drive/file_cache.h" |
10 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 10 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 if (error != FILE_ERROR_OK) | 42 if (error != FILE_ERROR_OK) |
43 return error; | 43 return error; |
44 if (!entries.empty()) | 44 if (!entries.empty()) |
45 return FILE_ERROR_NOT_EMPTY; | 45 return FILE_ERROR_NOT_EMPTY; |
46 } | 46 } |
47 | 47 |
48 error = cache->Remove(*local_id); | 48 error = cache->Remove(*local_id); |
49 if (error != FILE_ERROR_OK) | 49 if (error != FILE_ERROR_OK) |
50 return error; | 50 return error; |
51 | 51 |
52 *changed_directory_path = metadata->GetFilePath(*local_id).DirName(); | 52 *changed_directory_path = path.DirName(); |
53 | 53 |
54 // Move to the trash. | 54 // Move to the trash. |
55 entry.set_parent_local_id(util::kDriveTrashDirLocalId); | 55 entry.set_parent_local_id(util::kDriveTrashDirLocalId); |
56 return metadata->RefreshEntry(entry); | 56 return metadata->RefreshEntry(entry); |
57 } | 57 } |
58 | 58 |
59 } // namespace | 59 } // namespace |
60 | 60 |
61 RemoveOperation::RemoveOperation( | 61 RemoveOperation::RemoveOperation( |
62 base::SequencedTaskRunner* blocking_task_runner, | 62 base::SequencedTaskRunner* blocking_task_runner, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (error == FILE_ERROR_OK) { | 111 if (error == FILE_ERROR_OK) { |
112 observer_->OnDirectoryChangedByOperation(*changed_directory_path); | 112 observer_->OnDirectoryChangedByOperation(*changed_directory_path); |
113 observer_->OnEntryUpdatedByOperation(*local_id); | 113 observer_->OnEntryUpdatedByOperation(*local_id); |
114 } | 114 } |
115 | 115 |
116 callback.Run(error); | 116 callback.Run(error); |
117 } | 117 } |
118 | 118 |
119 } // namespace file_system | 119 } // namespace file_system |
120 } // namespace drive | 120 } // namespace drive |
OLD | NEW |