| 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_v1/fake_api_util.h" | 5 #include "chrome/browser/sync_file_system/drive_backend_v1/fake_api_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "webkit/common/blob/scoped_file.h" | 13 #include "storage/common/blob/scoped_file.h" |
| 14 | 14 |
| 15 namespace sync_file_system { | 15 namespace sync_file_system { |
| 16 namespace drive_backend { | 16 namespace drive_backend { |
| 17 | 17 |
| 18 bool FakeAPIUtil::RemoteResourceComparator::operator()( | 18 bool FakeAPIUtil::RemoteResourceComparator::operator()( |
| 19 const RemoteResource& left, | 19 const RemoteResource& left, |
| 20 const RemoteResource& right) { | 20 const RemoteResource& right) { |
| 21 if (left.parent_resource_id != right.parent_resource_id) | 21 if (left.parent_resource_id != right.parent_resource_id) |
| 22 return left.parent_resource_id < right.parent_resource_id; | 22 return left.parent_resource_id < right.parent_resource_id; |
| 23 if (left.parent_title != right.parent_title) | 23 if (left.parent_title != right.parent_title) |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 if (found != remote_resources_.end() && !found->second.deleted) { | 155 if (found != remote_resources_.end() && !found->second.deleted) { |
| 156 scoped_ptr<google_apis::ResourceEntry> entry( | 156 scoped_ptr<google_apis::ResourceEntry> entry( |
| 157 CreateResourceEntry(found->second)); | 157 CreateResourceEntry(found->second)); |
| 158 file_md5 = entry->file_md5(); | 158 file_md5 = entry->file_md5(); |
| 159 file_size = entry->file_size(); | 159 file_size = entry->file_size(); |
| 160 updated_time = entry->updated_time(); | 160 updated_time = entry->updated_time(); |
| 161 error = google_apis::HTTP_SUCCESS; | 161 error = google_apis::HTTP_SUCCESS; |
| 162 } | 162 } |
| 163 | 163 |
| 164 webkit_blob::ScopedFile dummy; | 164 storage::ScopedFile dummy; |
| 165 base::ThreadTaskRunnerHandle::Get()->PostTask( | 165 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 166 FROM_HERE, | 166 FROM_HERE, |
| 167 base::Bind(callback, error, file_md5, file_size, updated_time, | 167 base::Bind(callback, error, file_md5, file_size, updated_time, |
| 168 base::Passed(&dummy))); | 168 base::Passed(&dummy))); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void FakeAPIUtil::UploadNewFile(const std::string& directory_resource_id, | 171 void FakeAPIUtil::UploadNewFile(const std::string& directory_resource_id, |
| 172 const base::FilePath& local_file_path, | 172 const base::FilePath& local_file_path, |
| 173 const std::string& title, | 173 const std::string& title, |
| 174 const UploadFileCallback& callback) { | 174 const UploadFileCallback& callback) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return entry.Pass(); | 265 return entry.Pass(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 GURL FakeAPIUtil::ResourceIdToResourceLink( | 268 GURL FakeAPIUtil::ResourceIdToResourceLink( |
| 269 const std::string& resource_id) const { | 269 const std::string& resource_id) const { |
| 270 return url_generator_.GenerateEditUrl(resource_id); | 270 return url_generator_.GenerateEditUrl(resource_id); |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace drive_backend | 273 } // namespace drive_backend |
| 274 } // namespace sync_file_system | 274 } // namespace sync_file_system |
| OLD | NEW |