| Index: chrome/browser/sync_file_system/sync_file_system_service.cc
|
| diff --git a/chrome/browser/sync_file_system/sync_file_system_service.cc b/chrome/browser/sync_file_system/sync_file_system_service.cc
|
| index ff4175fd987b8cb9e8609f1a080c7d00bb056a42..ac97196ce8fa3469927666c96182d72cc8045013 100644
|
| --- a/chrome/browser/sync_file_system/sync_file_system_service.cc
|
| +++ b/chrome/browser/sync_file_system/sync_file_system_service.cc
|
| @@ -147,7 +147,7 @@ class LocalSyncRunner : public SyncProcessRunner,
|
| factory_(this) {}
|
|
|
| virtual void StartSync(const SyncStatusCallback& callback) OVERRIDE {
|
| - sync_service()->local_service_->ProcessLocalChange(
|
| + GetSyncService()->local_service_->ProcessLocalChange(
|
| base::Bind(&LocalSyncRunner::DidProcessLocalChange,
|
| factory_.GetWeakPtr(), callback));
|
| }
|
| @@ -159,7 +159,7 @@ class LocalSyncRunner : public SyncProcessRunner,
|
| OnChangesUpdated(pending_changes);
|
|
|
| // Kick other sync runners just in case they're not running.
|
| - sync_service()->RunForEachSyncRunners(
|
| + GetSyncService()->RunForEachSyncRunners(
|
| &SyncProcessRunner::ScheduleIfNotRunning);
|
| }
|
|
|
| @@ -209,7 +209,7 @@ class RemoteSyncRunner : public SyncProcessRunner,
|
| OnChangesUpdated(pending_changes);
|
|
|
| // Kick other sync runners just in case they're not running.
|
| - sync_service()->RunForEachSyncRunners(
|
| + GetSyncService()->RunForEachSyncRunners(
|
| &SyncProcessRunner::ScheduleIfNotRunning);
|
| }
|
|
|
| @@ -217,7 +217,7 @@ class RemoteSyncRunner : public SyncProcessRunner,
|
| RemoteServiceState state,
|
| const std::string& description) OVERRIDE {
|
| // Just forward to SyncFileSystemService.
|
| - sync_service()->OnRemoteServiceStateUpdated(state, description);
|
| + GetSyncService()->OnRemoteServiceStateUpdated(state, description);
|
| last_state_ = state;
|
| }
|
|
|
| @@ -232,7 +232,7 @@ class RemoteSyncRunner : public SyncProcessRunner,
|
| url.DebugString().c_str());
|
|
|
| if (status == SYNC_STATUS_FILE_BUSY) {
|
| - sync_service()->local_service_->RegisterURLForWaitingSync(
|
| + GetSyncService()->local_service_->RegisterURLForWaitingSync(
|
| url, base::Bind(&RemoteSyncRunner::Schedule,
|
| factory_.GetWeakPtr()));
|
| }
|
| @@ -289,11 +289,6 @@ void SyncFileSystemService::InitializeForApp(
|
| AsWeakPtr(), app_origin, callback));
|
| }
|
|
|
| -SyncServiceState SyncFileSystemService::GetSyncServiceState() {
|
| - // For now we always query the state from the main RemoteFileSyncService.
|
| - return RemoteStateToSyncServiceState(remote_service_->GetCurrentState());
|
| -}
|
| -
|
| void SyncFileSystemService::GetExtensionStatusMap(
|
| const ExtensionStatusMapCallback& callback) {
|
| remote_service_->GetOriginStatusMap(
|
| @@ -356,6 +351,33 @@ LocalChangeProcessor* SyncFileSystemService::GetLocalChangeProcessor(
|
| return GetRemoteService(origin)->GetLocalChangeProcessor();
|
| }
|
|
|
| +void SyncFileSystemService::OnSyncIdle() {
|
| + int64 remote_changes = 0;
|
| + for (ScopedVector<SyncProcessRunner>::iterator iter =
|
| + remote_sync_runners_.begin();
|
| + iter != remote_sync_runners_.end(); ++iter)
|
| + remote_changes += (*iter)->pending_changes();
|
| + if (remote_changes == 0)
|
| + local_service_->PromoteDemotedChanges();
|
| +
|
| + int64 local_changes = 0;
|
| + for (ScopedVector<SyncProcessRunner>::iterator iter =
|
| + local_sync_runners_.begin();
|
| + iter != local_sync_runners_.end(); ++iter)
|
| + local_changes += (*iter)->pending_changes();
|
| + if (local_changes == 0 && v2_remote_service_)
|
| + v2_remote_service_->PromoteDemotedChanges();
|
| +}
|
| +
|
| +SyncServiceState SyncFileSystemService::GetSyncServiceState() {
|
| + // For now we always query the state from the main RemoteFileSyncService.
|
| + return RemoteStateToSyncServiceState(remote_service_->GetCurrentState());
|
| +}
|
| +
|
| +SyncFileSystemService* SyncFileSystemService::GetSyncService() {
|
| + return this;
|
| +}
|
| +
|
| SyncFileSystemService::SyncFileSystemService(Profile* profile)
|
| : profile_(profile),
|
| sync_enabled_(true) {
|
| @@ -579,24 +601,6 @@ void SyncFileSystemService::DidGetLocalChangeStatus(
|
| SYNC_FILE_STATUS_HAS_PENDING_CHANGES : SYNC_FILE_STATUS_SYNCED);
|
| }
|
|
|
| -void SyncFileSystemService::OnSyncIdle() {
|
| - int64 remote_changes = 0;
|
| - for (ScopedVector<SyncProcessRunner>::iterator iter =
|
| - remote_sync_runners_.begin();
|
| - iter != remote_sync_runners_.end(); ++iter)
|
| - remote_changes += (*iter)->pending_changes();
|
| - if (remote_changes == 0)
|
| - local_service_->PromoteDemotedChanges();
|
| -
|
| - int64 local_changes = 0;
|
| - for (ScopedVector<SyncProcessRunner>::iterator iter =
|
| - local_sync_runners_.begin();
|
| - iter != local_sync_runners_.end(); ++iter)
|
| - local_changes += (*iter)->pending_changes();
|
| - if (local_changes == 0 && v2_remote_service_)
|
| - v2_remote_service_->PromoteDemotedChanges();
|
| -}
|
| -
|
| void SyncFileSystemService::OnRemoteServiceStateUpdated(
|
| RemoteServiceState state,
|
| const std::string& description) {
|
|
|