| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/sync_file_system/drive_backend/fake_sync_worker.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/fake_sync_worker.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.
h" | 10 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.
h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 sync_enabled_ = enabled; | 125 sync_enabled_ = enabled; |
| 126 | 126 |
| 127 if (enabled) | 127 if (enabled) |
| 128 UpdateServiceState(REMOTE_SERVICE_OK, "Set FakeSyncWorker enabled."); | 128 UpdateServiceState(REMOTE_SERVICE_OK, "Set FakeSyncWorker enabled."); |
| 129 else | 129 else |
| 130 UpdateServiceState(REMOTE_SERVICE_DISABLED, "Disabled FakeSyncWorker."); | 130 UpdateServiceState(REMOTE_SERVICE_DISABLED, "Disabled FakeSyncWorker."); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void FakeSyncWorker::PromoteDemotedChanges(const base::Closure& callback) { | 133 void FakeSyncWorker::PromoteDemotedChanges(const base::Closure& callback) { |
| 134 DCHECK(sequence_checker_.CalledOnValidSequence()); | 134 DCHECK(sequence_checker_.CalledOnValidSequence()); |
| 135 FOR_EACH_OBSERVER( | 135 for (auto& observer : observers_) |
| 136 Observer, | 136 observer.OnPendingFileListUpdated(10); |
| 137 observers_, | |
| 138 OnPendingFileListUpdated(10)); | |
| 139 callback.Run(); | 137 callback.Run(); |
| 140 } | 138 } |
| 141 | 139 |
| 142 void FakeSyncWorker::ApplyLocalChange(const FileChange& local_change, | 140 void FakeSyncWorker::ApplyLocalChange(const FileChange& local_change, |
| 143 const base::FilePath& local_path, | 141 const base::FilePath& local_path, |
| 144 const SyncFileMetadata& local_metadata, | 142 const SyncFileMetadata& local_metadata, |
| 145 const storage::FileSystemURL& url, | 143 const storage::FileSystemURL& url, |
| 146 const SyncStatusCallback& callback) { | 144 const SyncStatusCallback& callback) { |
| 147 DCHECK(sequence_checker_.CalledOnValidSequence()); | 145 DCHECK(sequence_checker_.CalledOnValidSequence()); |
| 148 callback.Run(SYNC_STATUS_OK); | 146 callback.Run(SYNC_STATUS_OK); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 165 | 163 |
| 166 void FakeSyncWorker::AddObserver(Observer* observer) { | 164 void FakeSyncWorker::AddObserver(Observer* observer) { |
| 167 // This method is called on UI thread. | 165 // This method is called on UI thread. |
| 168 observers_.AddObserver(observer); | 166 observers_.AddObserver(observer); |
| 169 } | 167 } |
| 170 | 168 |
| 171 void FakeSyncWorker::UpdateServiceState(RemoteServiceState state, | 169 void FakeSyncWorker::UpdateServiceState(RemoteServiceState state, |
| 172 const std::string& description) { | 170 const std::string& description) { |
| 173 DCHECK(sequence_checker_.CalledOnValidSequence()); | 171 DCHECK(sequence_checker_.CalledOnValidSequence()); |
| 174 | 172 |
| 175 FOR_EACH_OBSERVER( | 173 for (auto& observer : observers_) |
| 176 Observer, observers_, | 174 observer.UpdateServiceState(state, description); |
| 177 UpdateServiceState(state, description)); | |
| 178 } | 175 } |
| 179 | 176 |
| 180 } // namespace drive_backend | 177 } // namespace drive_backend |
| 181 } // namespace sync_file_system | 178 } // namespace sync_file_system |
| OLD | NEW |