| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 sync_enabled_ = enabled; | 268 sync_enabled_ = enabled; |
| 269 if (old_state == GetCurrentState()) | 269 if (old_state == GetCurrentState()) |
| 270 return; | 270 return; |
| 271 | 271 |
| 272 const char* status_message = enabled ? "Sync is enabled" : "Sync is disabled"; | 272 const char* status_message = enabled ? "Sync is enabled" : "Sync is disabled"; |
| 273 FOR_EACH_OBSERVER( | 273 FOR_EACH_OBSERVER( |
| 274 Observer, service_observers_, | 274 Observer, service_observers_, |
| 275 OnRemoteServiceStateUpdated(GetCurrentState(), status_message)); | 275 OnRemoteServiceStateUpdated(GetCurrentState(), status_message)); |
| 276 } | 276 } |
| 277 | 277 |
| 278 SyncStatusCode SyncEngine::SetConflictResolutionPolicy( | 278 SyncStatusCode SyncEngine::SetDefaultConflictResolutionPolicy( |
| 279 ConflictResolutionPolicy policy) { | 279 ConflictResolutionPolicy policy) { |
| 280 conflict_resolution_policy_ = policy; | 280 default_conflict_resolution_policy_ = policy; |
| 281 return SYNC_STATUS_OK; | 281 return SYNC_STATUS_OK; |
| 282 } | 282 } |
| 283 | 283 |
| 284 ConflictResolutionPolicy SyncEngine::GetConflictResolutionPolicy() const { | 284 SyncStatusCode SyncEngine::SetConflictResolutionPolicy( |
| 285 return conflict_resolution_policy_; | 285 const GURL& origin, |
| 286 ConflictResolutionPolicy policy) { |
| 287 NOTIMPLEMENTED(); |
| 288 default_conflict_resolution_policy_ = policy; |
| 289 return SYNC_STATUS_OK; |
| 290 } |
| 291 |
| 292 ConflictResolutionPolicy SyncEngine::GetDefaultConflictResolutionPolicy() |
| 293 const { |
| 294 return default_conflict_resolution_policy_; |
| 295 } |
| 296 |
| 297 ConflictResolutionPolicy SyncEngine::GetConflictResolutionPolicy( |
| 298 const GURL& origin) const { |
| 299 NOTIMPLEMENTED(); |
| 300 return default_conflict_resolution_policy_; |
| 286 } | 301 } |
| 287 | 302 |
| 288 void SyncEngine::GetRemoteVersions( | 303 void SyncEngine::GetRemoteVersions( |
| 289 const fileapi::FileSystemURL& url, | 304 const fileapi::FileSystemURL& url, |
| 290 const RemoteVersionsCallback& callback) { | 305 const RemoteVersionsCallback& callback) { |
| 291 // TODO(tzik): Implement this before we support manual conflict resolution. | 306 // TODO(tzik): Implement this before we support manual conflict resolution. |
| 292 callback.Run(SYNC_STATUS_FAILED, std::vector<Version>()); | 307 callback.Run(SYNC_STATUS_FAILED, std::vector<Version>()); |
| 293 } | 308 } |
| 294 | 309 |
| 295 void SyncEngine::DownloadRemoteVersion( | 310 void SyncEngine::DownloadRemoteVersion( |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 drive_uploader_(drive_uploader.Pass()), | 449 drive_uploader_(drive_uploader.Pass()), |
| 435 notification_manager_(notification_manager), | 450 notification_manager_(notification_manager), |
| 436 extension_service_(extension_service), | 451 extension_service_(extension_service), |
| 437 auth_token_service_(auth_token_service), | 452 auth_token_service_(auth_token_service), |
| 438 remote_change_processor_(NULL), | 453 remote_change_processor_(NULL), |
| 439 service_state_(REMOTE_SERVICE_TEMPORARY_UNAVAILABLE), | 454 service_state_(REMOTE_SERVICE_TEMPORARY_UNAVAILABLE), |
| 440 should_check_conflict_(true), | 455 should_check_conflict_(true), |
| 441 should_check_remote_change_(true), | 456 should_check_remote_change_(true), |
| 442 listing_remote_changes_(false), | 457 listing_remote_changes_(false), |
| 443 sync_enabled_(false), | 458 sync_enabled_(false), |
| 444 conflict_resolution_policy_(CONFLICT_RESOLUTION_POLICY_LAST_WRITE_WIN), | 459 default_conflict_resolution_policy_( |
| 460 CONFLICT_RESOLUTION_POLICY_LAST_WRITE_WIN), |
| 445 network_available_(false), | 461 network_available_(false), |
| 446 weak_ptr_factory_(this) { | 462 weak_ptr_factory_(this) { |
| 447 } | 463 } |
| 448 | 464 |
| 449 void SyncEngine::DoDisableApp(const std::string& app_id, | 465 void SyncEngine::DoDisableApp(const std::string& app_id, |
| 450 const SyncStatusCallback& callback) { | 466 const SyncStatusCallback& callback) { |
| 451 if (metadata_database_) | 467 if (metadata_database_) |
| 452 metadata_database_->DisableApp(app_id, callback); | 468 metadata_database_->DisableApp(app_id, callback); |
| 453 else | 469 else |
| 454 callback.Run(SYNC_STATUS_OK); | 470 callback.Run(SYNC_STATUS_OK); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 tracker.tracker_kind() == TRACKER_KIND_APP_ROOT; | 741 tracker.tracker_kind() == TRACKER_KIND_APP_ROOT; |
| 726 if (is_app_enabled && !is_app_root_tracker_enabled) | 742 if (is_app_enabled && !is_app_root_tracker_enabled) |
| 727 EnableOrigin(origin, base::Bind(&EmptyStatusCallback)); | 743 EnableOrigin(origin, base::Bind(&EmptyStatusCallback)); |
| 728 else if (!is_app_enabled && is_app_root_tracker_enabled) | 744 else if (!is_app_enabled && is_app_root_tracker_enabled) |
| 729 DisableOrigin(origin, base::Bind(&EmptyStatusCallback)); | 745 DisableOrigin(origin, base::Bind(&EmptyStatusCallback)); |
| 730 } | 746 } |
| 731 } | 747 } |
| 732 | 748 |
| 733 } // namespace drive_backend | 749 } // namespace drive_backend |
| 734 } // namespace sync_file_system | 750 } // namespace sync_file_system |
| OLD | NEW |