| 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/remote_to_local_syncer.h
" | 5 #include "chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "chrome/browser/drive/drive_api_util.h" |
| 13 #include "chrome/browser/drive/drive_service_interface.h" |
| 14 #include "chrome/browser/google_apis/drive_api_parser.h" |
| 15 #include "chrome/browser/google_apis/gdata_wapi_parser.h" |
| 12 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" | 16 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
| 13 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" | 17 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" |
| 14 | 18 |
| 15 namespace sync_file_system { | 19 namespace sync_file_system { |
| 16 namespace drive_backend { | 20 namespace drive_backend { |
| 17 | 21 |
| 18 namespace { | 22 namespace { |
| 19 | 23 |
| 20 bool BuildFileSystemURLForTracker( | 24 bool BuildFileSystemURLForTracker( |
| 21 MetadataDatabase* metadata_database, | 25 MetadataDatabase* metadata_database, |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (missing_parent_) { | 173 if (missing_parent_) { |
| 170 HandleReorganize(callback); | 174 HandleReorganize(callback); |
| 171 return; | 175 return; |
| 172 } | 176 } |
| 173 | 177 |
| 174 HandleOfflineSolvable(callback); | 178 HandleOfflineSolvable(callback); |
| 175 } | 179 } |
| 176 | 180 |
| 177 void RemoteToLocalSyncer::GetRemoteResource( | 181 void RemoteToLocalSyncer::GetRemoteResource( |
| 178 const SyncStatusCallback& callback) { | 182 const SyncStatusCallback& callback) { |
| 179 // TODO(tzik): FileMetadata is missing, retrieve and store it to | 183 drive_service()->GetResourceEntry( |
| 180 // MetadataDatabase. | 184 dirty_tracker_.file_id(), |
| 185 base::Bind(&RemoteToLocalSyncer::DidGetRemoteResource, |
| 186 weak_ptr_factory_.GetWeakPtr(), |
| 187 callback, |
| 188 metadata_database()->GetLargestChangeID())); |
| 189 } |
| 181 | 190 |
| 182 NOTIMPLEMENTED(); | 191 void RemoteToLocalSyncer::DidGetRemoteResource( |
| 183 callback.Run(SYNC_STATUS_FAILED); | 192 const SyncStatusCallback& callback, |
| 193 int64 change_id, |
| 194 google_apis::GDataErrorCode error, |
| 195 scoped_ptr<google_apis::ResourceEntry> entry) { |
| 196 metadata_database()->UpdateByFileResource( |
| 197 change_id, |
| 198 *drive::util::ConvertResourceEntryToFileResource(*entry), |
| 199 callback); |
| 184 } | 200 } |
| 185 | 201 |
| 186 void RemoteToLocalSyncer::HandleDeletion( | 202 void RemoteToLocalSyncer::HandleDeletion( |
| 187 const SyncStatusCallback& callback) { | 203 const SyncStatusCallback& callback) { |
| 188 NOTIMPLEMENTED(); | 204 NOTIMPLEMENTED(); |
| 189 callback.Run(SYNC_STATUS_FAILED); | 205 callback.Run(SYNC_STATUS_FAILED); |
| 190 } | 206 } |
| 191 | 207 |
| 192 void RemoteToLocalSyncer::HandleNewFile( | 208 void RemoteToLocalSyncer::HandleNewFile( |
| 193 const SyncStatusCallback& callback) { | 209 const SyncStatusCallback& callback) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 return sync_context_->GetMetadataDatabase(); | 269 return sync_context_->GetMetadataDatabase(); |
| 254 } | 270 } |
| 255 | 271 |
| 256 RemoteChangeProcessor* RemoteToLocalSyncer::remote_change_processor() { | 272 RemoteChangeProcessor* RemoteToLocalSyncer::remote_change_processor() { |
| 257 DCHECK(sync_context_->GetRemoteChangeProcessor()); | 273 DCHECK(sync_context_->GetRemoteChangeProcessor()); |
| 258 return sync_context_->GetRemoteChangeProcessor(); | 274 return sync_context_->GetRemoteChangeProcessor(); |
| 259 } | 275 } |
| 260 | 276 |
| 261 } // namespace drive_backend | 277 } // namespace drive_backend |
| 262 } // namespace sync_file_system | 278 } // namespace sync_file_system |
| OLD | NEW |