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/sync_file_system/drive_backend/sync_engine.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 FROM_HERE, | 333 FROM_HERE, |
334 base::Bind(&SyncWorker::SetRemoteChangeProcessor, | 334 base::Bind(&SyncWorker::SetRemoteChangeProcessor, |
335 base::Unretained(sync_worker_.get()), | 335 base::Unretained(sync_worker_.get()), |
336 remote_change_processor_on_worker_.get())); | 336 remote_change_processor_on_worker_.get())); |
337 } | 337 } |
338 | 338 |
339 LocalChangeProcessor* SyncEngine::GetLocalChangeProcessor() { | 339 LocalChangeProcessor* SyncEngine::GetLocalChangeProcessor() { |
340 return this; | 340 return this; |
341 } | 341 } |
342 | 342 |
343 bool SyncEngine::IsConflicting(const fileapi::FileSystemURL& url) { | |
344 // TODO(tzik): Implement this before we support manual conflict resolution. | |
345 return false; | |
346 } | |
347 | |
348 RemoteServiceState SyncEngine::GetCurrentState() const { | 343 RemoteServiceState SyncEngine::GetCurrentState() const { |
349 return service_state_; | 344 return service_state_; |
350 } | 345 } |
351 | 346 |
352 void SyncEngine::GetOriginStatusMap(OriginStatusMap* status_map) { | 347 void SyncEngine::GetOriginStatusMap(OriginStatusMap* status_map) { |
353 // TODO(peria): Make this route asynchronous. | 348 // TODO(peria): Make this route asynchronous. |
354 sync_worker_->GetOriginStatusMap(status_map); | 349 sync_worker_->GetOriginStatusMap(status_map); |
355 } | 350 } |
356 | 351 |
357 void SyncEngine::DumpFiles(const GURL& origin, | 352 void SyncEngine::DumpFiles(const GURL& origin, |
(...skipping 17 matching lines...) Expand all Loading... |
375 } | 370 } |
376 | 371 |
377 void SyncEngine::SetSyncEnabled(bool enabled) { | 372 void SyncEngine::SetSyncEnabled(bool enabled) { |
378 worker_task_runner_->PostTask( | 373 worker_task_runner_->PostTask( |
379 FROM_HERE, | 374 FROM_HERE, |
380 base::Bind(&SyncWorker::SetSyncEnabled, | 375 base::Bind(&SyncWorker::SetSyncEnabled, |
381 base::Unretained(sync_worker_.get()), | 376 base::Unretained(sync_worker_.get()), |
382 enabled)); | 377 enabled)); |
383 } | 378 } |
384 | 379 |
385 SyncStatusCode SyncEngine::SetDefaultConflictResolutionPolicy( | |
386 ConflictResolutionPolicy policy) { | |
387 // TODO(peria): Make this route asynchronous. | |
388 return sync_worker_->SetDefaultConflictResolutionPolicy(policy); | |
389 } | |
390 | |
391 SyncStatusCode SyncEngine::SetConflictResolutionPolicy( | |
392 const GURL& origin, | |
393 ConflictResolutionPolicy policy) { | |
394 // TODO(peria): Make this route asynchronous. | |
395 return sync_worker_->SetConflictResolutionPolicy(origin, policy); | |
396 } | |
397 | |
398 ConflictResolutionPolicy SyncEngine::GetDefaultConflictResolutionPolicy() | |
399 const { | |
400 // TODO(peria): Make this route asynchronous. | |
401 return sync_worker_->GetDefaultConflictResolutionPolicy(); | |
402 } | |
403 | |
404 ConflictResolutionPolicy SyncEngine::GetConflictResolutionPolicy( | |
405 const GURL& origin) const { | |
406 // TODO(peria): Make this route asynchronous. | |
407 return sync_worker_->GetConflictResolutionPolicy(origin); | |
408 } | |
409 | |
410 void SyncEngine::GetRemoteVersions( | |
411 const fileapi::FileSystemURL& url, | |
412 const RemoteVersionsCallback& callback) { | |
413 // TODO(tzik): Implement this before we support manual conflict resolution. | |
414 callback.Run(SYNC_STATUS_FAILED, std::vector<Version>()); | |
415 } | |
416 | |
417 void SyncEngine::DownloadRemoteVersion( | |
418 const fileapi::FileSystemURL& url, | |
419 const std::string& version_id, | |
420 const DownloadVersionCallback& callback) { | |
421 // TODO(tzik): Implement this before we support manual conflict resolution. | |
422 callback.Run(SYNC_STATUS_FAILED, webkit_blob::ScopedFile()); | |
423 } | |
424 | |
425 void SyncEngine::PromoteDemotedChanges() { | 380 void SyncEngine::PromoteDemotedChanges() { |
426 MetadataDatabase* metadata_db = GetMetadataDatabase(); | 381 MetadataDatabase* metadata_db = GetMetadataDatabase(); |
427 if (metadata_db && metadata_db->HasLowPriorityDirtyTracker()) { | 382 if (metadata_db && metadata_db->HasLowPriorityDirtyTracker()) { |
428 metadata_db->PromoteLowerPriorityTrackersToNormal(); | 383 metadata_db->PromoteLowerPriorityTrackersToNormal(); |
429 FOR_EACH_OBSERVER( | 384 FOR_EACH_OBSERVER( |
430 Observer, | 385 Observer, |
431 service_observers_, | 386 service_observers_, |
432 OnRemoteChangeQueueUpdated(metadata_db->CountDirtyTracker())); | 387 OnRemoteChangeQueueUpdated(metadata_db->CountDirtyTracker())); |
433 } | 388 } |
434 } | 389 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 tracker.tracker_kind() == TRACKER_KIND_APP_ROOT; | 537 tracker.tracker_kind() == TRACKER_KIND_APP_ROOT; |
583 if (is_app_enabled && !is_app_root_tracker_enabled) | 538 if (is_app_enabled && !is_app_root_tracker_enabled) |
584 EnableOrigin(origin, base::Bind(&EmptyStatusCallback)); | 539 EnableOrigin(origin, base::Bind(&EmptyStatusCallback)); |
585 else if (!is_app_enabled && is_app_root_tracker_enabled) | 540 else if (!is_app_enabled && is_app_root_tracker_enabled) |
586 DisableOrigin(origin, base::Bind(&EmptyStatusCallback)); | 541 DisableOrigin(origin, base::Bind(&EmptyStatusCallback)); |
587 } | 542 } |
588 } | 543 } |
589 | 544 |
590 } // namespace drive_backend | 545 } // namespace drive_backend |
591 } // namespace sync_file_system | 546 } // namespace sync_file_system |
OLD | NEW |