| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "components/drive/chromeos/fake_file_system.h" | 5 #include "components/drive/chromeos/fake_file_system.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 |
| 9 #include <memory> |
| 8 #include <utility> | 10 #include <utility> |
| 11 #include <vector> |
| 9 | 12 |
| 10 #include "base/bind.h" | 13 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 12 #include "base/callback.h" | 15 #include "base/callback.h" |
| 13 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 14 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
| 15 #include "base/logging.h" | 18 #include "base/logging.h" |
| 16 #include "components/drive/drive.pb.h" | 19 #include "components/drive/drive.pb.h" |
| 17 #include "components/drive/file_errors.h" | 20 #include "components/drive/file_errors.h" |
| 18 #include "components/drive/file_system_core_util.h" | 21 #include "components/drive/file_system_core_util.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 std::unique_ptr<google_apis::FileList> file_list) { | 400 std::unique_ptr<google_apis::FileList> file_list) { |
| 398 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 401 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 399 | 402 |
| 400 FileError error = GDataToFileError(gdata_error); | 403 FileError error = GDataToFileError(gdata_error); |
| 401 if (error != FILE_ERROR_OK) { | 404 if (error != FILE_ERROR_OK) { |
| 402 callback.Run(error, std::unique_ptr<ResourceEntry>()); | 405 callback.Run(error, std::unique_ptr<ResourceEntry>()); |
| 403 return; | 406 return; |
| 404 } | 407 } |
| 405 | 408 |
| 406 DCHECK(file_list); | 409 DCHECK(file_list); |
| 407 const ScopedVector<google_apis::FileResource>& entries = file_list->items(); | 410 const std::vector<std::unique_ptr<google_apis::FileResource>>& entries = |
| 411 file_list->items(); |
| 408 for (size_t i = 0; i < entries.size(); ++i) { | 412 for (size_t i = 0; i < entries.size(); ++i) { |
| 409 std::unique_ptr<ResourceEntry> entry(new ResourceEntry); | 413 std::unique_ptr<ResourceEntry> entry(new ResourceEntry); |
| 410 std::string parent_resource_id; | 414 std::string parent_resource_id; |
| 411 bool converted = ConvertFileResourceToResourceEntry( | 415 bool converted = ConvertFileResourceToResourceEntry( |
| 412 *entries[i], entry.get(), &parent_resource_id); | 416 *entries[i], entry.get(), &parent_resource_id); |
| 413 DCHECK(converted); | 417 DCHECK(converted); |
| 414 entry->set_parent_local_id(parent_resource_id); | 418 entry->set_parent_local_id(parent_resource_id); |
| 415 | 419 |
| 416 if (entry->base_name() == base_name.AsUTF8Unsafe()) { | 420 if (entry->base_name() == base_name.AsUTF8Unsafe()) { |
| 417 // Found the target entry. | 421 // Found the target entry. |
| 418 callback.Run(FILE_ERROR_OK, std::move(entry)); | 422 callback.Run(FILE_ERROR_OK, std::move(entry)); |
| 419 return; | 423 return; |
| 420 } | 424 } |
| 421 } | 425 } |
| 422 | 426 |
| 423 callback.Run(FILE_ERROR_NOT_FOUND, std::unique_ptr<ResourceEntry>()); | 427 callback.Run(FILE_ERROR_NOT_FOUND, std::unique_ptr<ResourceEntry>()); |
| 424 } | 428 } |
| 425 | 429 |
| 426 } // namespace test_util | 430 } // namespace test_util |
| 427 } // namespace drive | 431 } // namespace drive |
| OLD | NEW |