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/sync_worker.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_worker.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 void SyncWorker::SetSyncEnabled(bool enabled) { | 238 void SyncWorker::SetSyncEnabled(bool enabled) { |
239 if (sync_enabled_ == enabled) | 239 if (sync_enabled_ == enabled) |
240 return; | 240 return; |
241 | 241 |
242 RemoteServiceState old_state = GetCurrentState(); | 242 RemoteServiceState old_state = GetCurrentState(); |
243 sync_enabled_ = enabled; | 243 sync_enabled_ = enabled; |
244 if (old_state == GetCurrentState()) | 244 if (old_state == GetCurrentState()) |
245 return; | 245 return; |
246 | 246 |
247 FOR_EACH_OBSERVER( | 247 FOR_EACH_OBSERVER( |
248 Observer, observers_, | 248 Observer, |
| 249 observers_, |
249 UpdateServiceState( | 250 UpdateServiceState( |
250 GetCurrentState(), | 251 GetCurrentState(), |
251 enabled ? "Sync is enabled" : "Sync is disabled")); | 252 enabled ? "Sync is enabled" : "Sync is disabled")); |
252 } | 253 } |
253 | 254 |
| 255 void SyncWorker::PromoteDemotedChanges() { |
| 256 MetadataDatabase* metadata_db = GetMetadataDatabase(); |
| 257 if (metadata_db && metadata_db->HasLowPriorityDirtyTracker()) { |
| 258 metadata_db->PromoteLowerPriorityTrackersToNormal(); |
| 259 FOR_EACH_OBSERVER( |
| 260 Observer, |
| 261 observers_, |
| 262 OnPendingFileListUpdated(metadata_db->CountDirtyTracker())); |
| 263 } |
| 264 } |
| 265 |
254 SyncStatusCode SyncWorker::SetDefaultConflictResolutionPolicy( | 266 SyncStatusCode SyncWorker::SetDefaultConflictResolutionPolicy( |
255 ConflictResolutionPolicy policy) { | 267 ConflictResolutionPolicy policy) { |
256 default_conflict_resolution_policy_ = policy; | 268 default_conflict_resolution_policy_ = policy; |
257 return SYNC_STATUS_OK; | 269 return SYNC_STATUS_OK; |
258 } | 270 } |
259 | 271 |
260 SyncStatusCode SyncWorker::SetConflictResolutionPolicy( | 272 SyncStatusCode SyncWorker::SetConflictResolutionPolicy( |
261 const GURL& origin, | 273 const GURL& origin, |
262 ConflictResolutionPolicy policy) { | 274 ConflictResolutionPolicy policy) { |
263 NOTIMPLEMENTED(); | 275 NOTIMPLEMENTED(); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 "Service state changed: %d->%d: %s", | 706 "Service state changed: %d->%d: %s", |
695 old_state, GetCurrentState(), description.c_str()); | 707 old_state, GetCurrentState(), description.c_str()); |
696 | 708 |
697 FOR_EACH_OBSERVER( | 709 FOR_EACH_OBSERVER( |
698 Observer, observers_, | 710 Observer, observers_, |
699 UpdateServiceState(GetCurrentState(), description)); | 711 UpdateServiceState(GetCurrentState(), description)); |
700 } | 712 } |
701 | 713 |
702 } // namespace drive_backend | 714 } // namespace drive_backend |
703 } // namespace sync_file_system | 715 } // namespace sync_file_system |
OLD | NEW |