Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: chrome/browser/chromeos/drive/sync/remove_performer.cc

Issue 881403003: Rename gdata_errorcode.h to drive_api_error_codes.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos in BUILD.gn Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/operation_delegate.h" 9 #include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
10 #include "chrome/browser/chromeos/drive/file_system_util.h" 10 #include "chrome/browser/chromeos/drive/file_system_util.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 resource_id, 139 resource_id,
140 context, 140 context,
141 base::Bind(&RemovePerformer::TrashResourceAfterUpdateRemoteState, 141 base::Bind(&RemovePerformer::TrashResourceAfterUpdateRemoteState,
142 weak_ptr_factory_.GetWeakPtr(), context, callback, local_id)); 142 weak_ptr_factory_.GetWeakPtr(), context, callback, local_id));
143 } 143 }
144 144
145 void RemovePerformer::TrashResourceAfterUpdateRemoteState( 145 void RemovePerformer::TrashResourceAfterUpdateRemoteState(
146 const ClientContext& context, 146 const ClientContext& context,
147 const FileOperationCallback& callback, 147 const FileOperationCallback& callback,
148 const std::string& local_id, 148 const std::string& local_id,
149 google_apis::GDataErrorCode status) { 149 google_apis::DriveApiErrorCode status) {
150 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 150 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
151 DCHECK(!callback.is_null()); 151 DCHECK(!callback.is_null());
152 152
153 if (status == google_apis::HTTP_FORBIDDEN) { 153 if (status == google_apis::HTTP_FORBIDDEN) {
154 // Editing this entry is not allowed, revert local changes. 154 // Editing this entry is not allowed, revert local changes.
155 entry_revert_performer_->RevertEntry(local_id, context, callback); 155 entry_revert_performer_->RevertEntry(local_id, context, callback);
156 delegate_->OnDriveSyncError( 156 delegate_->OnDriveSyncError(
157 file_system::DRIVE_SYNC_ERROR_DELETE_WITHOUT_PERMISSION, local_id); 157 file_system::DRIVE_SYNC_ERROR_DELETE_WITHOUT_PERMISSION, local_id);
158 return; 158 return;
159 } 159 }
(...skipping 21 matching lines...) Expand all
181 resource_id, 181 resource_id,
182 context, 182 context,
183 base::Bind(&RemovePerformer::UnparentResourceAfterGetFileResource, 183 base::Bind(&RemovePerformer::UnparentResourceAfterGetFileResource,
184 weak_ptr_factory_.GetWeakPtr(), context, callback, local_id)); 184 weak_ptr_factory_.GetWeakPtr(), context, callback, local_id));
185 } 185 }
186 186
187 void RemovePerformer::UnparentResourceAfterGetFileResource( 187 void RemovePerformer::UnparentResourceAfterGetFileResource(
188 const ClientContext& context, 188 const ClientContext& context,
189 const FileOperationCallback& callback, 189 const FileOperationCallback& callback,
190 const std::string& local_id, 190 const std::string& local_id,
191 google_apis::GDataErrorCode status, 191 google_apis::DriveApiErrorCode status,
192 scoped_ptr<google_apis::FileResource> file_resource) { 192 scoped_ptr<google_apis::FileResource> file_resource) {
193 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 193 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
194 DCHECK(!callback.is_null()); 194 DCHECK(!callback.is_null());
195 195
196 FileError error = GDataToFileError(status); 196 FileError error = GDataToFileError(status);
197 if (error == FILE_ERROR_NOT_FOUND) { // Remove local entry when not found. 197 if (error == FILE_ERROR_NOT_FOUND) { // Remove local entry when not found.
198 RemoveEntryOnUIThread(blocking_task_runner_.get(), metadata_, local_id, 198 RemoveEntryOnUIThread(blocking_task_runner_.get(), metadata_, local_id,
199 callback); 199 callback);
200 return; 200 return;
201 } 201 }
(...skipping 29 matching lines...) Expand all
231 parent_resource_id, 231 parent_resource_id,
232 entry.resource_id(), 232 entry.resource_id(),
233 context, 233 context,
234 base::Bind(&RemovePerformer::UnparentResourceAfterUpdateRemoteState, 234 base::Bind(&RemovePerformer::UnparentResourceAfterUpdateRemoteState,
235 weak_ptr_factory_.GetWeakPtr(), callback, local_id)); 235 weak_ptr_factory_.GetWeakPtr(), callback, local_id));
236 } 236 }
237 237
238 void RemovePerformer::UnparentResourceAfterUpdateRemoteState( 238 void RemovePerformer::UnparentResourceAfterUpdateRemoteState(
239 const FileOperationCallback& callback, 239 const FileOperationCallback& callback,
240 const std::string& local_id, 240 const std::string& local_id,
241 google_apis::GDataErrorCode status) { 241 google_apis::DriveApiErrorCode status) {
242 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 242 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
243 DCHECK(!callback.is_null()); 243 DCHECK(!callback.is_null());
244 244
245 FileError error = GDataToFileError(status); 245 FileError error = GDataToFileError(status);
246 if (error != FILE_ERROR_OK) { 246 if (error != FILE_ERROR_OK) {
247 callback.Run(error); 247 callback.Run(error);
248 return; 248 return;
249 } 249 }
250 250
251 base::PostTaskAndReplyWithResult( 251 base::PostTaskAndReplyWithResult(
252 blocking_task_runner_.get(), 252 blocking_task_runner_.get(),
253 FROM_HERE, 253 FROM_HERE,
254 base::Bind(&UpdateLocalStateAfterUnparent, metadata_, local_id), 254 base::Bind(&UpdateLocalStateAfterUnparent, metadata_, local_id),
255 callback); 255 callback);
256 } 256 }
257 257
258 } // namespace internal 258 } // namespace internal
259 } // namespace drive 259 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698