| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/drive/drive_api_service.h" | 10 #include "chrome/browser/drive/drive_api_service.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 syncer->target_path()); | 508 syncer->target_path()); |
| 509 } | 509 } |
| 510 FOR_EACH_OBSERVER(FileStatusObserver, | 510 FOR_EACH_OBSERVER(FileStatusObserver, |
| 511 file_status_observers_, | 511 file_status_observers_, |
| 512 OnFileStatusChanged(updated_url, | 512 OnFileStatusChanged(updated_url, |
| 513 SYNC_FILE_STATUS_SYNCED, | 513 SYNC_FILE_STATUS_SYNCED, |
| 514 syncer->sync_action(), | 514 syncer->sync_action(), |
| 515 SYNC_DIRECTION_LOCAL_TO_REMOTE)); | 515 SYNC_DIRECTION_LOCAL_TO_REMOTE)); |
| 516 } | 516 } |
| 517 | 517 |
| 518 if (status == SYNC_STATUS_UNKNOWN_ORIGIN && syncer->url().is_valid()) { |
| 519 RegisterOrigin(syncer->url().origin(), |
| 520 base::Bind(&EmptyStatusCallback)); |
| 521 } |
| 522 |
| 518 if (status != SYNC_STATUS_OK && | 523 if (status != SYNC_STATUS_OK && |
| 519 status != SYNC_STATUS_NO_CHANGE_TO_SYNC) { | 524 status != SYNC_STATUS_NO_CHANGE_TO_SYNC) { |
| 520 callback.Run(status); | 525 callback.Run(status); |
| 521 return; | 526 return; |
| 522 } | 527 } |
| 523 | 528 |
| 524 if (status == SYNC_STATUS_NO_CHANGE_TO_SYNC) | 529 if (status == SYNC_STATUS_NO_CHANGE_TO_SYNC) |
| 525 metadata_database_->PromoteLowerPriorityTrackersToNormal(); | 530 metadata_database_->PromoteLowerPriorityTrackersToNormal(); |
| 526 | 531 |
| 527 if (status == SYNC_STATUS_OK) | 532 if (status == SYNC_STATUS_OK) |
| 528 should_check_conflict_ = true; | 533 should_check_conflict_ = true; |
| 529 | 534 |
| 530 if (status == SYNC_STATUS_UNKNOWN_ORIGIN && syncer->url().is_valid()) { | |
| 531 RegisterOrigin(syncer->url().origin(), | |
| 532 base::Bind(&EmptyStatusCallback)); | |
| 533 } | |
| 534 | |
| 535 callback.Run(status); | 535 callback.Run(status); |
| 536 } | 536 } |
| 537 | 537 |
| 538 void SyncEngine::MaybeStartFetchChanges() { | 538 void SyncEngine::MaybeStartFetchChanges() { |
| 539 if (GetCurrentState() == REMOTE_SERVICE_DISABLED) | 539 if (GetCurrentState() == REMOTE_SERVICE_DISABLED) |
| 540 return; | 540 return; |
| 541 | 541 |
| 542 if (!metadata_database_) | 542 if (!metadata_database_) |
| 543 return; | 543 return; |
| 544 | 544 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 tracker.tracker_kind() == TRACKER_KIND_APP_ROOT; | 670 tracker.tracker_kind() == TRACKER_KIND_APP_ROOT; |
| 671 if (is_app_enabled && !is_app_root_tracker_enabled) | 671 if (is_app_enabled && !is_app_root_tracker_enabled) |
| 672 EnableOrigin(origin, base::Bind(&EmptyStatusCallback)); | 672 EnableOrigin(origin, base::Bind(&EmptyStatusCallback)); |
| 673 else if (!is_app_enabled && is_app_root_tracker_enabled) | 673 else if (!is_app_enabled && is_app_root_tracker_enabled) |
| 674 DisableOrigin(origin, base::Bind(&EmptyStatusCallback)); | 674 DisableOrigin(origin, base::Bind(&EmptyStatusCallback)); |
| 675 } | 675 } |
| 676 } | 676 } |
| 677 | 677 |
| 678 } // namespace drive_backend | 678 } // namespace drive_backend |
| 679 } // namespace sync_file_system | 679 } // namespace sync_file_system |
| OLD | NEW |