| 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_v1/remote_sync_delegate.
h" | 5 #include "chrome/browser/sync_file_system/drive_backend_v1/remote_sync_delegate.
h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "chrome/browser/sync_file_system/drive_backend_v1/remote_sync_operation
_resolver.h" | 8 #include "chrome/browser/sync_file_system/drive_backend_v1/remote_sync_operation
_resolver.h" |
| 9 #include "chrome/browser/sync_file_system/logger.h" | 9 #include "chrome/browser/sync_file_system/logger.h" |
| 10 #include "chrome/browser/sync_file_system/remote_change_processor.h" | 10 #include "chrome/browser/sync_file_system/remote_change_processor.h" |
| 11 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 11 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 12 | 12 |
| 13 using fileapi::FileSystemURL; | 13 using storage::FileSystemURL; |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 void EmptyStatusCallback(sync_file_system::SyncStatusCode status) {} | 17 void EmptyStatusCallback(sync_file_system::SyncStatusCode status) {} |
| 18 | 18 |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 namespace sync_file_system { | 21 namespace sync_file_system { |
| 22 namespace drive_backend { | 22 namespace drive_backend { |
| 23 | 23 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 md5_checksum = drive_metadata_.md5_checksum(); | 193 md5_checksum = drive_metadata_.md5_checksum(); |
| 194 | 194 |
| 195 api_util()->DownloadFile( | 195 api_util()->DownloadFile( |
| 196 remote_change_.resource_id, | 196 remote_change_.resource_id, |
| 197 md5_checksum, | 197 md5_checksum, |
| 198 base::Bind(&RemoteSyncDelegate::DidDownloadFile, | 198 base::Bind(&RemoteSyncDelegate::DidDownloadFile, |
| 199 AsWeakPtr(), | 199 AsWeakPtr(), |
| 200 callback)); | 200 callback)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void RemoteSyncDelegate::DidDownloadFile( | 203 void RemoteSyncDelegate::DidDownloadFile(const SyncStatusCallback& callback, |
| 204 const SyncStatusCallback& callback, | 204 google_apis::GDataErrorCode error, |
| 205 google_apis::GDataErrorCode error, | 205 const std::string& md5_checksum, |
| 206 const std::string& md5_checksum, | 206 int64 file_size, |
| 207 int64 file_size, | 207 const base::Time& updated_time, |
| 208 const base::Time& updated_time, | 208 storage::ScopedFile downloaded_file) { |
| 209 webkit_blob::ScopedFile downloaded_file) { | |
| 210 if (error == google_apis::HTTP_NOT_MODIFIED) { | 209 if (error == google_apis::HTTP_NOT_MODIFIED) { |
| 211 sync_action_ = SYNC_ACTION_NONE; | 210 sync_action_ = SYNC_ACTION_NONE; |
| 212 DidApplyRemoteChange(callback, SYNC_STATUS_OK); | 211 DidApplyRemoteChange(callback, SYNC_STATUS_OK); |
| 213 return; | 212 return; |
| 214 } | 213 } |
| 215 | 214 |
| 216 // File may be deleted. If this was for new file it's ok, if this was | 215 // File may be deleted. If this was for new file it's ok, if this was |
| 217 // for existing file we'll process the delete change later. | 216 // for existing file we'll process the delete change later. |
| 218 if (error == google_apis::HTTP_NOT_FOUND) { | 217 if (error == google_apis::HTTP_NOT_FOUND) { |
| 219 sync_action_ = SYNC_ACTION_NONE; | 218 sync_action_ = SYNC_ACTION_NONE; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 RemoteChangeProcessor* RemoteSyncDelegate::remote_change_processor() { | 482 RemoteChangeProcessor* RemoteSyncDelegate::remote_change_processor() { |
| 484 return sync_service_->remote_change_processor_; | 483 return sync_service_->remote_change_processor_; |
| 485 } | 484 } |
| 486 | 485 |
| 487 ConflictResolutionResolver* RemoteSyncDelegate::conflict_resolution_resolver() { | 486 ConflictResolutionResolver* RemoteSyncDelegate::conflict_resolution_resolver() { |
| 488 return &sync_service_->conflict_resolution_resolver_; | 487 return &sync_service_->conflict_resolution_resolver_; |
| 489 } | 488 } |
| 490 | 489 |
| 491 } // namespace drive_backend | 490 } // namespace drive_backend |
| 492 } // namespace sync_file_system | 491 } // namespace sync_file_system |
| OLD | NEW |