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/sync_file_system_service.h" | 5 #include "chrome/browser/sync_file_system/sync_file_system_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 DCHECK(!origin.is_empty()); | 498 DCHECK(!origin.is_empty()); |
499 | 499 |
500 if (status != SYNC_STATUS_OK) { | 500 if (status != SYNC_STATUS_OK) { |
501 base::ListValue empty_result; | 501 base::ListValue empty_result; |
502 callback.Run(&empty_result); | 502 callback.Run(&empty_result); |
503 return; | 503 return; |
504 } | 504 } |
505 | 505 |
506 base::ListValue* files = | 506 base::ListValue* files = |
507 GetRemoteService(origin)->DumpFiles(origin).release(); | 507 GetRemoteService(origin)->DumpFiles(origin).release(); |
| 508 if (!files) { |
| 509 callback.Run(new base::ListValue); |
| 510 return; |
| 511 } |
| 512 |
508 if (!files->GetSize()) { | 513 if (!files->GetSize()) { |
509 callback.Run(files); | 514 callback.Run(files); |
510 return; | 515 return; |
511 } | 516 } |
512 | 517 |
513 base::Callback<void(base::DictionaryValue* file, | 518 base::Callback<void(base::DictionaryValue* file, |
514 SyncStatusCode sync_status, | 519 SyncStatusCode sync_status, |
515 SyncFileStatus sync_file_status)> completion_callback = | 520 SyncFileStatus sync_file_status)> completion_callback = |
516 base::Bind(&DidGetFileSyncStatusForDump, base::Owned(files), | 521 base::Bind(&DidGetFileSyncStatusForDump, base::Owned(files), |
517 base::Owned(new size_t(0)), callback); | 522 base::Owned(new size_t(0)), callback); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 v2_remote_service_.get())); | 740 v2_remote_service_.get())); |
736 v2_remote_service_->AddServiceObserver(v2_remote_syncer.get()); | 741 v2_remote_service_->AddServiceObserver(v2_remote_syncer.get()); |
737 v2_remote_service_->AddFileStatusObserver(this); | 742 v2_remote_service_->AddFileStatusObserver(this); |
738 v2_remote_service_->SetRemoteChangeProcessor(local_service_.get()); | 743 v2_remote_service_->SetRemoteChangeProcessor(local_service_.get()); |
739 sync_runners_.push_back(v2_remote_syncer.release()); | 744 sync_runners_.push_back(v2_remote_syncer.release()); |
740 } | 745 } |
741 return v2_remote_service_.get(); | 746 return v2_remote_service_.get(); |
742 } | 747 } |
743 | 748 |
744 } // namespace sync_file_system | 749 } // namespace sync_file_system |
OLD | NEW |