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/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 scoped_ptr<FileMetadata> GetFileMetadata(MetadataDatabase* database, | 72 scoped_ptr<FileMetadata> GetFileMetadata(MetadataDatabase* database, |
73 const std::string& file_id) { | 73 const std::string& file_id) { |
74 scoped_ptr<FileMetadata> metadata(new FileMetadata); | 74 scoped_ptr<FileMetadata> metadata(new FileMetadata); |
75 if (!database->FindFileByFileID(file_id, metadata.get())) | 75 if (!database->FindFileByFileID(file_id, metadata.get())) |
76 metadata.reset(); | 76 metadata.reset(); |
77 return metadata.Pass(); | 77 return metadata.Pass(); |
78 } | 78 } |
79 | 79 |
80 // Creates a temporary file in |dir_path|. This must be called on an | 80 // Creates a temporary file in |dir_path|. This must be called on an |
81 // IO-allowed task runner, and the runner must be given as |file_task_runner|. | 81 // IO-allowed task runner, and the runner must be given as |file_task_runner|. |
82 storage::ScopedFile CreateTemporaryFile(base::TaskRunner* file_task_runner) { | 82 storage::ScopedFile CreateTemporaryFile( |
| 83 const scoped_refptr<base::TaskRunner>& file_task_runner) { |
83 base::FilePath temp_file_path; | 84 base::FilePath temp_file_path; |
84 if (!base::CreateTemporaryFile(&temp_file_path)) | 85 if (!base::CreateTemporaryFile(&temp_file_path)) |
85 return storage::ScopedFile(); | 86 return storage::ScopedFile(); |
86 | 87 |
87 return storage::ScopedFile(temp_file_path, | 88 return storage::ScopedFile(temp_file_path, |
88 storage::ScopedFile::DELETE_ON_SCOPE_OUT, | 89 storage::ScopedFile::DELETE_ON_SCOPE_OUT, |
89 file_task_runner); | 90 file_task_runner); |
90 } | 91 } |
91 | 92 |
92 } // namespace | 93 } // namespace |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 | 763 |
763 SyncStatusCallback RemoteToLocalSyncer::SyncCompletedCallback( | 764 SyncStatusCallback RemoteToLocalSyncer::SyncCompletedCallback( |
764 scoped_ptr<SyncTaskToken> token) { | 765 scoped_ptr<SyncTaskToken> token) { |
765 return base::Bind(&RemoteToLocalSyncer::SyncCompleted, | 766 return base::Bind(&RemoteToLocalSyncer::SyncCompleted, |
766 weak_ptr_factory_.GetWeakPtr(), | 767 weak_ptr_factory_.GetWeakPtr(), |
767 base::Passed(&token)); | 768 base::Passed(&token)); |
768 } | 769 } |
769 | 770 |
770 } // namespace drive_backend | 771 } // namespace drive_backend |
771 } // namespace sync_file_system | 772 } // namespace sync_file_system |
OLD | NEW |