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/drive_file_sync_service.
h" | 5 #include "chrome/browser/sync_file_system/drive_backend/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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 ConflictResolutionPolicy DriveFileSyncService::kDefaultPolicy = | 83 ConflictResolutionPolicy DriveFileSyncService::kDefaultPolicy = |
84 CONFLICT_RESOLUTION_POLICY_LAST_WRITE_WIN; | 84 CONFLICT_RESOLUTION_POLICY_LAST_WRITE_WIN; |
85 | 85 |
86 // DriveFileSyncService ------------------------------------------------------ | 86 // DriveFileSyncService ------------------------------------------------------ |
87 | 87 |
88 DriveFileSyncService::~DriveFileSyncService() { | 88 DriveFileSyncService::~DriveFileSyncService() { |
89 if (api_util_) | 89 if (api_util_) |
90 api_util_->RemoveObserver(this); | 90 api_util_->RemoveObserver(this); |
91 | 91 |
92 drive::DriveNotificationManager* drive_notification_manager = | 92 drive::DriveNotificationManager* drive_notification_manager = |
93 drive::DriveNotificationManagerFactory::GetForProfile(profile_); | 93 drive::DriveNotificationManagerFactory::GetForBrowserContext(profile_); |
94 if (drive_notification_manager) | 94 if (drive_notification_manager) |
95 drive_notification_manager->RemoveObserver(this); | 95 drive_notification_manager->RemoveObserver(this); |
96 } | 96 } |
97 | 97 |
98 scoped_ptr<DriveFileSyncService> DriveFileSyncService::Create( | 98 scoped_ptr<DriveFileSyncService> DriveFileSyncService::Create( |
99 Profile* profile) { | 99 Profile* profile) { |
100 scoped_ptr<DriveFileSyncService> service(new DriveFileSyncService(profile)); | 100 scoped_ptr<DriveFileSyncService> service(new DriveFileSyncService(profile)); |
101 scoped_ptr<SyncTaskManager> task_manager( | 101 scoped_ptr<SyncTaskManager> task_manager( |
102 new SyncTaskManager(service->AsWeakPtr())); | 102 new SyncTaskManager(service->AsWeakPtr())); |
103 SyncStatusCallback callback = base::Bind( | 103 SyncStatusCallback callback = base::Bind( |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 AppendFetchChange(url.origin(), url.path(), resource_id, file_type); | 417 AppendFetchChange(url.origin(), url.path(), resource_id, file_type); |
418 } | 418 } |
419 | 419 |
420 if (!sync_root_resource_id().empty()) | 420 if (!sync_root_resource_id().empty()) |
421 api_util_->EnsureSyncRootIsNotInMyDrive(sync_root_resource_id()); | 421 api_util_->EnsureSyncRootIsNotInMyDrive(sync_root_resource_id()); |
422 | 422 |
423 callback.Run(status); | 423 callback.Run(status); |
424 may_have_unfetched_changes_ = true; | 424 may_have_unfetched_changes_ = true; |
425 | 425 |
426 drive::DriveNotificationManager* drive_notification_manager = | 426 drive::DriveNotificationManager* drive_notification_manager = |
427 drive::DriveNotificationManagerFactory::GetForProfile(profile_); | 427 drive::DriveNotificationManagerFactory::GetForBrowserContext(profile_); |
428 if (drive_notification_manager) | 428 if (drive_notification_manager) |
429 drive_notification_manager->AddObserver(this); | 429 drive_notification_manager->AddObserver(this); |
430 } | 430 } |
431 | 431 |
432 void DriveFileSyncService::UpdateServiceStateFromLastOperationStatus( | 432 void DriveFileSyncService::UpdateServiceStateFromLastOperationStatus( |
433 SyncStatusCode sync_status, | 433 SyncStatusCode sync_status, |
434 google_apis::GDataErrorCode gdata_error) { | 434 google_apis::GDataErrorCode gdata_error) { |
435 switch (sync_status) { | 435 switch (sync_status) { |
436 case SYNC_STATUS_OK: | 436 case SYNC_STATUS_OK: |
437 // If the last Drive-related operation was successful we can | 437 // If the last Drive-related operation was successful we can |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 metadata_store_->SetOriginRootDirectory(origin, resource_id); | 1403 metadata_store_->SetOriginRootDirectory(origin, resource_id); |
1404 } | 1404 } |
1405 callback.Run(status, resource_id); | 1405 callback.Run(status, resource_id); |
1406 } | 1406 } |
1407 | 1407 |
1408 std::string DriveFileSyncService::sync_root_resource_id() { | 1408 std::string DriveFileSyncService::sync_root_resource_id() { |
1409 return metadata_store_->sync_root_directory(); | 1409 return metadata_store_->sync_root_directory(); |
1410 } | 1410 } |
1411 | 1411 |
1412 } // namespace sync_file_system | 1412 } // namespace sync_file_system |
OLD | NEW |