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

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

Issue 137903002: Files.app: Add a drive sync error event to the fileBrowserPrivate API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed typo. Created 6 years, 11 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 | Annotate | Revision Log
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_observer.h"
9 #include "chrome/browser/chromeos/drive/file_system_util.h" 10 #include "chrome/browser/chromeos/drive/file_system_util.h"
10 #include "chrome/browser/chromeos/drive/job_scheduler.h" 11 #include "chrome/browser/chromeos/drive/job_scheduler.h"
11 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" 12 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
12 #include "chrome/browser/chromeos/drive/sync/entry_revert_performer.h" 13 #include "chrome/browser/chromeos/drive/sync/entry_revert_performer.h"
13 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
14 15
15 using content::BrowserThread; 16 using content::BrowserThread;
16 17
17 namespace drive { 18 namespace drive {
18 namespace internal { 19 namespace internal {
(...skipping 25 matching lines...) Expand all
44 } 45 }
45 46
46 } // namespace 47 } // namespace
47 48
48 RemovePerformer::RemovePerformer( 49 RemovePerformer::RemovePerformer(
49 base::SequencedTaskRunner* blocking_task_runner, 50 base::SequencedTaskRunner* blocking_task_runner,
50 file_system::OperationObserver* observer, 51 file_system::OperationObserver* observer,
51 JobScheduler* scheduler, 52 JobScheduler* scheduler,
52 ResourceMetadata* metadata) 53 ResourceMetadata* metadata)
53 : blocking_task_runner_(blocking_task_runner), 54 : blocking_task_runner_(blocking_task_runner),
55 observer_(observer),
54 scheduler_(scheduler), 56 scheduler_(scheduler),
55 metadata_(metadata), 57 metadata_(metadata),
56 entry_revert_performer_(new EntryRevertPerformer(blocking_task_runner, 58 entry_revert_performer_(new EntryRevertPerformer(blocking_task_runner,
57 observer, 59 observer,
58 scheduler, 60 scheduler,
59 metadata)), 61 metadata)),
60 weak_ptr_factory_(this) { 62 weak_ptr_factory_(this) {
61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
62 } 64 }
63 65
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 void RemovePerformer::TrashResourceAfterUpdateRemoteState( 129 void RemovePerformer::TrashResourceAfterUpdateRemoteState(
128 const FileOperationCallback& callback, 130 const FileOperationCallback& callback,
129 const std::string& local_id, 131 const std::string& local_id,
130 google_apis::GDataErrorCode status) { 132 google_apis::GDataErrorCode status) {
131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 133 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
132 DCHECK(!callback.is_null()); 134 DCHECK(!callback.is_null());
133 135
134 if (status == google_apis::HTTP_FORBIDDEN) { 136 if (status == google_apis::HTTP_FORBIDDEN) {
135 // Editing this entry is not allowed, revert local changes. 137 // Editing this entry is not allowed, revert local changes.
136 entry_revert_performer_->RevertEntry(local_id, callback); 138 entry_revert_performer_->RevertEntry(local_id, callback);
139 observer_->OnDriveSyncError(file_system::DELETE_WITHOUT_PERMISSION);
137 return; 140 return;
138 } 141 }
139 142
140 FileError error = GDataToFileError(status); 143 FileError error = GDataToFileError(status);
141 if (error == FILE_ERROR_NOT_FOUND) { // Remove local entry when not found. 144 if (error == FILE_ERROR_NOT_FOUND) { // Remove local entry when not found.
142 RemoveEntryOnUIThread(blocking_task_runner_.get(), metadata_, local_id, 145 RemoveEntryOnUIThread(blocking_task_runner_.get(), metadata_, local_id,
143 callback); 146 callback);
144 return; 147 return;
145 } 148 }
146 149
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 230
228 base::PostTaskAndReplyWithResult( 231 base::PostTaskAndReplyWithResult(
229 blocking_task_runner_.get(), 232 blocking_task_runner_.get(),
230 FROM_HERE, 233 FROM_HERE,
231 base::Bind(&UpdateLocalStateAfterUnparent, metadata_, local_id), 234 base::Bind(&UpdateLocalStateAfterUnparent, metadata_, local_id),
232 callback); 235 callback);
233 } 236 }
234 237
235 } // namespace internal 238 } // namespace internal
236 } // namespace drive 239 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/sync/remove_performer.h ('k') | chrome/browser/chromeos/extensions/file_manager/event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698