OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_file_sync_service.h" | 5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 const GURL& origin, | 493 const GURL& origin, |
494 const SyncStatusCallback& callback) { | 494 const SyncStatusCallback& callback) { |
495 remote_change_handler_.RemoveChangesForOrigin(origin); | 495 remote_change_handler_.RemoveChangesForOrigin(origin); |
496 pending_batch_sync_origins_.erase(origin); | 496 pending_batch_sync_origins_.erase(origin); |
497 metadata_store_->RemoveOrigin(origin, callback); | 497 metadata_store_->RemoveOrigin(origin, callback); |
498 } | 498 } |
499 | 499 |
500 void DriveFileSyncService::DoEnableOriginForTrackingChanges( | 500 void DriveFileSyncService::DoEnableOriginForTrackingChanges( |
501 const GURL& origin, | 501 const GURL& origin, |
502 const SyncStatusCallback& callback) { | 502 const SyncStatusCallback& callback) { |
| 503 // If origin cannot be found in disabled list, then it's not a SyncFS app |
| 504 // and should be ignored. |
503 if (!metadata_store_->IsOriginDisabled(origin)) { | 505 if (!metadata_store_->IsOriginDisabled(origin)) { |
504 callback.Run(SYNC_STATUS_OK); | 506 callback.Run(SYNC_STATUS_OK); |
505 return; | 507 return; |
506 } | 508 } |
507 | 509 |
508 metadata_store_->EnableOrigin(origin, callback); | |
509 pending_batch_sync_origins_.insert( | 510 pending_batch_sync_origins_.insert( |
510 *metadata_store_->disabled_origins().find(origin)); | 511 *metadata_store_->disabled_origins().find(origin)); |
| 512 metadata_store_->EnableOrigin(origin, callback); |
511 } | 513 } |
512 | 514 |
513 void DriveFileSyncService::DoDisableOriginForTrackingChanges( | 515 void DriveFileSyncService::DoDisableOriginForTrackingChanges( |
514 const GURL& origin, | 516 const GURL& origin, |
515 const SyncStatusCallback& callback) { | 517 const SyncStatusCallback& callback) { |
516 pending_batch_sync_origins_.erase(origin); | 518 pending_batch_sync_origins_.erase(origin); |
517 if (!metadata_store_->IsIncrementalSyncOrigin(origin)) { | 519 if (!metadata_store_->IsIncrementalSyncOrigin(origin)) { |
518 callback.Run(SYNC_STATUS_OK); | 520 callback.Run(SYNC_STATUS_OK); |
519 return; | 521 return; |
520 } | 522 } |
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 metadata_store_->SetOriginRootDirectory(origin, resource_id); | 1736 metadata_store_->SetOriginRootDirectory(origin, resource_id); |
1735 } | 1737 } |
1736 callback.Run(status, resource_id); | 1738 callback.Run(status, resource_id); |
1737 } | 1739 } |
1738 | 1740 |
1739 std::string DriveFileSyncService::sync_root_resource_id() { | 1741 std::string DriveFileSyncService::sync_root_resource_id() { |
1740 return metadata_store_->sync_root_directory(); | 1742 return metadata_store_->sync_root_directory(); |
1741 } | 1743 } |
1742 | 1744 |
1743 } // namespace sync_file_system | 1745 } // namespace sync_file_system |
OLD | NEW |