| 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/entry_revert_performer.h" | 5 #include "chrome/browser/chromeos/drive/sync/entry_revert_performer.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/drive/change_list_processor.h" | 7 #include "chrome/browser/chromeos/drive/change_list_processor.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/operation_observer.h" |
| 10 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 10 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 void EntryRevertPerformer::RevertEntryAfterPrepare( | 105 void EntryRevertPerformer::RevertEntryAfterPrepare( |
| 106 const ClientContext& context, | 106 const ClientContext& context, |
| 107 const FileOperationCallback& callback, | 107 const FileOperationCallback& callback, |
| 108 scoped_ptr<ResourceEntry> entry, | 108 scoped_ptr<ResourceEntry> entry, |
| 109 FileError error) { | 109 FileError error) { |
| 110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 111 DCHECK(!callback.is_null()); | 111 DCHECK(!callback.is_null()); |
| 112 | 112 |
| 113 if (error == FILE_ERROR_OK && entry->resource_id().empty()) |
| 114 error = FILE_ERROR_INVALID_OPERATION; |
| 115 |
| 113 if (error != FILE_ERROR_OK) { | 116 if (error != FILE_ERROR_OK) { |
| 114 callback.Run(error); | 117 callback.Run(error); |
| 115 return; | 118 return; |
| 116 } | 119 } |
| 117 | 120 |
| 118 scheduler_->GetResourceEntry( | 121 scheduler_->GetResourceEntry( |
| 119 entry->resource_id(), | 122 entry->resource_id(), |
| 120 context, | 123 context, |
| 121 base::Bind(&EntryRevertPerformer::RevertEntryAfterGetResourceEntry, | 124 base::Bind(&EntryRevertPerformer::RevertEntryAfterGetResourceEntry, |
| 122 weak_ptr_factory_.GetWeakPtr(), callback, entry->local_id())); | 125 weak_ptr_factory_.GetWeakPtr(), callback, entry->local_id())); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 150 | 153 |
| 151 for (std::set<base::FilePath>::const_iterator it = | 154 for (std::set<base::FilePath>::const_iterator it = |
| 152 changed_directories->begin(); it != changed_directories->end(); ++it) | 155 changed_directories->begin(); it != changed_directories->end(); ++it) |
| 153 observer_->OnDirectoryChangedByOperation(*it); | 156 observer_->OnDirectoryChangedByOperation(*it); |
| 154 | 157 |
| 155 callback.Run(error); | 158 callback.Run(error); |
| 156 } | 159 } |
| 157 | 160 |
| 158 } // namespace internal | 161 } // namespace internal |
| 159 } // namespace drive | 162 } // namespace drive |
| OLD | NEW |