| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_worker.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_worker.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "chrome/browser/drive/drive_service_interface.h" | 10 #include "chrome/browser/drive/drive_service_interface.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 return; | 385 return; |
| 386 } | 386 } |
| 387 if (status != SYNC_STATUS_OK) { | 387 if (status != SYNC_STATUS_OK) { |
| 388 UpdateServiceState(REMOTE_SERVICE_TEMPORARY_UNAVAILABLE, | 388 UpdateServiceState(REMOTE_SERVICE_TEMPORARY_UNAVAILABLE, |
| 389 "Could not initialize remote service"); | 389 "Could not initialize remote service"); |
| 390 return; | 390 return; |
| 391 } | 391 } |
| 392 | 392 |
| 393 scoped_ptr<MetadataDatabase> metadata_database = | 393 scoped_ptr<MetadataDatabase> metadata_database = |
| 394 initializer->PassMetadataDatabase(); | 394 initializer->PassMetadataDatabase(); |
| 395 if (metadata_database) | 395 if (metadata_database) { |
| 396 context_->SetMetadataDatabase(metadata_database.Pass()); | 396 context_->SetMetadataDatabase(metadata_database.Pass()); |
| 397 return; |
| 398 } |
| 397 | 399 |
| 400 UpdateServiceState(REMOTE_SERVICE_OK, std::string()); |
| 398 UpdateRegisteredApps(); | 401 UpdateRegisteredApps(); |
| 399 } | 402 } |
| 400 | 403 |
| 401 void SyncWorker::UpdateRegisteredApps() { | 404 void SyncWorker::UpdateRegisteredApps() { |
| 402 MetadataDatabase* metadata_db = GetMetadataDatabase(); | 405 MetadataDatabase* metadata_db = GetMetadataDatabase(); |
| 403 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 406 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
| 404 DCHECK(metadata_db); | 407 DCHECK(metadata_db); |
| 405 | 408 |
| 406 scoped_ptr<std::vector<std::string> > app_ids(new std::vector<std::string>); | 409 scoped_ptr<std::vector<std::string> > app_ids(new std::vector<std::string>); |
| 407 metadata_db->GetRegisteredAppIDs(app_ids.get()); | 410 metadata_db->GetRegisteredAppIDs(app_ids.get()); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 return context_->GetDriveUploader(); | 711 return context_->GetDriveUploader(); |
| 709 } | 712 } |
| 710 | 713 |
| 711 MetadataDatabase* SyncWorker::GetMetadataDatabase() { | 714 MetadataDatabase* SyncWorker::GetMetadataDatabase() { |
| 712 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 715 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
| 713 return context_->GetMetadataDatabase(); | 716 return context_->GetMetadataDatabase(); |
| 714 } | 717 } |
| 715 | 718 |
| 716 } // namespace drive_backend | 719 } // namespace drive_backend |
| 717 } // namespace sync_file_system | 720 } // namespace sync_file_system |
| OLD | NEW |