| 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/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/drive/drive_api_service.h" | 9 #include "chrome/browser/drive/drive_api_service.h" |
| 10 #include "chrome/browser/drive/drive_notification_manager.h" | 10 #include "chrome/browser/drive/drive_notification_manager.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 const GURL& origin, | 112 const GURL& origin, |
| 113 UninstallFlag flag, | 113 UninstallFlag flag, |
| 114 const SyncStatusCallback& callback) { | 114 const SyncStatusCallback& callback) { |
| 115 task_manager_->ScheduleSyncTask( | 115 task_manager_->ScheduleSyncTask( |
| 116 scoped_ptr<SyncTask>(new UninstallAppTask(this, origin.host(), flag)), | 116 scoped_ptr<SyncTask>(new UninstallAppTask(this, origin.host(), flag)), |
| 117 callback); | 117 callback); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void SyncEngine::ProcessRemoteChange( | 120 void SyncEngine::ProcessRemoteChange( |
| 121 const SyncFileCallback& callback) { | 121 const SyncFileCallback& callback) { |
| 122 RemoteToLocalSyncer* syncer = new RemoteToLocalSyncer; | 122 RemoteToLocalSyncer* syncer = new RemoteToLocalSyncer(this); |
| 123 task_manager_->ScheduleSyncTask( | 123 task_manager_->ScheduleSyncTask( |
| 124 scoped_ptr<SyncTask>(syncer), | 124 scoped_ptr<SyncTask>(syncer), |
| 125 base::Bind(&SyncEngine::DidProcessRemoteChange, | 125 base::Bind(&SyncEngine::DidProcessRemoteChange, |
| 126 weak_ptr_factory_.GetWeakPtr(), | 126 weak_ptr_factory_.GetWeakPtr(), |
| 127 syncer, callback)); | 127 syncer, callback)); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void SyncEngine::SetRemoteChangeProcessor( | 130 void SyncEngine::SetRemoteChangeProcessor( |
| 131 RemoteChangeProcessor* processor) { | 131 RemoteChangeProcessor* processor) { |
| 132 remote_change_processor_ = processor; | 132 remote_change_processor_ = processor; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 const DownloadVersionCallback& callback) { | 194 const DownloadVersionCallback& callback) { |
| 195 NOTIMPLEMENTED(); | 195 NOTIMPLEMENTED(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void SyncEngine::ApplyLocalChange( | 198 void SyncEngine::ApplyLocalChange( |
| 199 const FileChange& local_file_change, | 199 const FileChange& local_file_change, |
| 200 const base::FilePath& local_file_path, | 200 const base::FilePath& local_file_path, |
| 201 const SyncFileMetadata& local_file_metadata, | 201 const SyncFileMetadata& local_file_metadata, |
| 202 const fileapi::FileSystemURL& url, | 202 const fileapi::FileSystemURL& url, |
| 203 const SyncStatusCallback& callback) { | 203 const SyncStatusCallback& callback) { |
| 204 LocalToRemoteSyncer* syncer = new LocalToRemoteSyncer; | 204 LocalToRemoteSyncer* syncer = new LocalToRemoteSyncer(this); |
| 205 task_manager_->ScheduleSyncTask( | 205 task_manager_->ScheduleSyncTask( |
| 206 scoped_ptr<SyncTask>(syncer), | 206 scoped_ptr<SyncTask>(syncer), |
| 207 base::Bind(&SyncEngine::DidApplyLocalChange, | 207 base::Bind(&SyncEngine::DidApplyLocalChange, |
| 208 weak_ptr_factory_.GetWeakPtr(), | 208 weak_ptr_factory_.GetWeakPtr(), |
| 209 syncer, callback)); | 209 syncer, callback)); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void SyncEngine::MaybeScheduleNextTask() { | 212 void SyncEngine::MaybeScheduleNextTask() { |
| 213 if (GetCurrentState() == REMOTE_SERVICE_DISABLED) | 213 if (GetCurrentState() == REMOTE_SERVICE_DISABLED) |
| 214 return; | 214 return; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 262 } |
| 263 | 263 |
| 264 drive::DriveServiceInterface* SyncEngine::GetDriveService() { | 264 drive::DriveServiceInterface* SyncEngine::GetDriveService() { |
| 265 return drive_service_.get(); | 265 return drive_service_.get(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 MetadataDatabase* SyncEngine::GetMetadataDatabase() { | 268 MetadataDatabase* SyncEngine::GetMetadataDatabase() { |
| 269 return metadata_database_.get(); | 269 return metadata_database_.get(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 RemoteChangeProcessor* SyncEngine::GetRemoteChangeProcessor() { |
| 273 return remote_change_processor_; |
| 274 } |
| 275 |
| 272 void SyncEngine::DoDisableApp(const std::string& app_id, | 276 void SyncEngine::DoDisableApp(const std::string& app_id, |
| 273 const SyncStatusCallback& callback) { | 277 const SyncStatusCallback& callback) { |
| 274 NOTIMPLEMENTED(); | 278 NOTIMPLEMENTED(); |
| 275 } | 279 } |
| 276 | 280 |
| 277 void SyncEngine::DoEnableApp(const std::string& app_id, | 281 void SyncEngine::DoEnableApp(const std::string& app_id, |
| 278 const SyncStatusCallback& callback) { | 282 const SyncStatusCallback& callback) { |
| 279 NOTIMPLEMENTED(); | 283 NOTIMPLEMENTED(); |
| 280 } | 284 } |
| 281 | 285 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 util::Log(logging::LOG_INFO, FROM_HERE, | 334 util::Log(logging::LOG_INFO, FROM_HERE, |
| 331 "Service state changed: %d->%d: %s", | 335 "Service state changed: %d->%d: %s", |
| 332 old_state, GetCurrentState(), description.c_str()); | 336 old_state, GetCurrentState(), description.c_str()); |
| 333 FOR_EACH_OBSERVER( | 337 FOR_EACH_OBSERVER( |
| 334 Observer, service_observers_, | 338 Observer, service_observers_, |
| 335 OnRemoteServiceStateUpdated(GetCurrentState(), description)); | 339 OnRemoteServiceStateUpdated(GetCurrentState(), description)); |
| 336 } | 340 } |
| 337 | 341 |
| 338 } // namespace drive_backend | 342 } // namespace drive_backend |
| 339 } // namespace sync_file_system | 343 } // namespace sync_file_system |
| OLD | NEW |