OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sync/remove_performer.h" | 5 #include "chrome/browser/chromeos/drive/sync/remove_performer.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_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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 | 120 |
121 void RemovePerformer::DeleteResourceAfterUpdateRemoteState( | 121 void RemovePerformer::DeleteResourceAfterUpdateRemoteState( |
122 const FileOperationCallback& callback, | 122 const FileOperationCallback& callback, |
123 const std::string& local_id, | 123 const std::string& local_id, |
124 google_apis::GDataErrorCode status) { | 124 google_apis::GDataErrorCode status) { |
125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
126 DCHECK(!callback.is_null()); | 126 DCHECK(!callback.is_null()); |
127 | 127 |
128 FileError error = GDataToFileError(status); | 128 FileError error = GDataToFileError(status); |
129 if (error != FILE_ERROR_OK && error != FILE_ERROR_NOT_FOUND) { | 129 if (error == FILE_ERROR_NOT_FOUND) { // Remove local entry when not found. |
130 callback.Run(error); | 130 RemoveEntryOnUIThread(blocking_task_runner_.get(), metadata_, local_id, |
| 131 callback); |
131 return; | 132 return; |
132 } | 133 } |
133 | 134 |
134 RemoveEntryOnUIThread(blocking_task_runner_.get(), metadata_, local_id, | 135 // Now we're done. If the entry is deleted on the server, it'll be also |
135 callback); | 136 // deleted locally on the next update. |
| 137 callback.Run(error); |
136 } | 138 } |
137 | 139 |
138 void RemovePerformer::UnparentResource( | 140 void RemovePerformer::UnparentResource( |
139 const FileOperationCallback& callback, | 141 const FileOperationCallback& callback, |
140 const std::string& resource_id, | 142 const std::string& resource_id, |
141 const std::string& local_id) { | 143 const std::string& local_id) { |
142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
143 DCHECK(!callback.is_null()); | 145 DCHECK(!callback.is_null()); |
144 | 146 |
145 scheduler_->GetResourceEntry( | 147 scheduler_->GetResourceEntry( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 201 |
200 base::PostTaskAndReplyWithResult( | 202 base::PostTaskAndReplyWithResult( |
201 blocking_task_runner_.get(), | 203 blocking_task_runner_.get(), |
202 FROM_HERE, | 204 FROM_HERE, |
203 base::Bind(&UpdateLocalStateAfterUnparent, metadata_, local_id), | 205 base::Bind(&UpdateLocalStateAfterUnparent, metadata_, local_id), |
204 callback); | 206 callback); |
205 } | 207 } |
206 | 208 |
207 } // namespace internal | 209 } // namespace internal |
208 } // namespace drive | 210 } // namespace drive |
OLD | NEW |