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/folder_creator.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/folder_creator.h" |
6 | 6 |
7 #include "chrome/browser/drive/drive_api_util.h" | 7 #include "chrome/browser/drive/drive_api_util.h" |
8 #include "chrome/browser/drive/drive_service_interface.h" | 8 #include "chrome/browser/drive/drive_service_interface.h" |
9 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" | 9 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" |
10 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" | 10 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 if (!oldest) { | 109 if (!oldest) { |
110 callback.Run(std::string(), SYNC_FILE_ERROR_NOT_FOUND); | 110 callback.Run(std::string(), SYNC_FILE_ERROR_NOT_FOUND); |
111 return; | 111 return; |
112 } | 112 } |
113 | 113 |
114 std::string file_id = oldest->file_id(); | 114 std::string file_id = oldest->file_id(); |
115 | 115 |
116 status = metadata_database_->UpdateByFileResourceList(candidates.Pass()); | 116 status = metadata_database_->UpdateByFileResourceList(candidates.Pass()); |
117 | |
118 // TODO(tzik): Expand this function. | |
119 DidUpdateDatabase(file_id, callback, status); | |
120 } | |
121 | |
122 void FolderCreator::DidUpdateDatabase(const std::string& file_id, | |
123 const FileIDCallback& callback, | |
124 SyncStatusCode status) { | |
125 if (status != SYNC_STATUS_OK) { | 117 if (status != SYNC_STATUS_OK) { |
126 callback.Run(std::string(), status); | 118 callback.Run(std::string(), status); |
127 return; | 119 return; |
128 } | 120 } |
129 | 121 |
130 DCHECK(!file_id.empty()); | 122 DCHECK(!file_id.empty()); |
131 if (!metadata_database_->FindFileByFileID(file_id, NULL)) { | 123 if (!metadata_database_->FindFileByFileID(file_id, NULL)) { |
132 callback.Run(std::string(), SYNC_FILE_ERROR_NOT_FOUND); | 124 callback.Run(std::string(), SYNC_FILE_ERROR_NOT_FOUND); |
133 return; | 125 return; |
134 } | 126 } |
135 | 127 |
136 callback.Run(file_id, status); | 128 callback.Run(file_id, status); |
137 } | 129 } |
138 | 130 |
139 } // namespace drive_backend | 131 } // namespace drive_backend |
140 } // namespace sync_file_system | 132 } // namespace sync_file_system |
OLD | NEW |