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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 std::unique_ptr<google_apis::FileList> file_list) { | 397 std::unique_ptr<google_apis::FileList> file_list) { |
398 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 398 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
399 | 399 |
400 FileError error = GDataToFileError(gdata_error); | 400 FileError error = GDataToFileError(gdata_error); |
401 if (error != FILE_ERROR_OK) { | 401 if (error != FILE_ERROR_OK) { |
402 callback.Run(error, std::unique_ptr<ResourceEntry>()); | 402 callback.Run(error, std::unique_ptr<ResourceEntry>()); |
403 return; | 403 return; |
404 } | 404 } |
405 | 405 |
406 DCHECK(file_list); | 406 DCHECK(file_list); |
407 const ScopedVector<google_apis::FileResource>& entries = file_list->items(); | 407 const std::vector<std::unique_ptr<google_apis::FileResource>>& entries = |
| 408 file_list->items(); |
408 for (size_t i = 0; i < entries.size(); ++i) { | 409 for (size_t i = 0; i < entries.size(); ++i) { |
409 std::unique_ptr<ResourceEntry> entry(new ResourceEntry); | 410 std::unique_ptr<ResourceEntry> entry(new ResourceEntry); |
410 std::string parent_resource_id; | 411 std::string parent_resource_id; |
411 bool converted = ConvertFileResourceToResourceEntry( | 412 bool converted = ConvertFileResourceToResourceEntry( |
412 *entries[i], entry.get(), &parent_resource_id); | 413 *entries[i], entry.get(), &parent_resource_id); |
413 DCHECK(converted); | 414 DCHECK(converted); |
414 entry->set_parent_local_id(parent_resource_id); | 415 entry->set_parent_local_id(parent_resource_id); |
415 | 416 |
416 if (entry->base_name() == base_name.AsUTF8Unsafe()) { | 417 if (entry->base_name() == base_name.AsUTF8Unsafe()) { |
417 // Found the target entry. | 418 // Found the target entry. |
418 callback.Run(FILE_ERROR_OK, std::move(entry)); | 419 callback.Run(FILE_ERROR_OK, std::move(entry)); |
419 return; | 420 return; |
420 } | 421 } |
421 } | 422 } |
422 | 423 |
423 callback.Run(FILE_ERROR_NOT_FOUND, std::unique_ptr<ResourceEntry>()); | 424 callback.Run(FILE_ERROR_NOT_FOUND, std::unique_ptr<ResourceEntry>()); |
424 } | 425 } |
425 | 426 |
426 } // namespace test_util | 427 } // namespace test_util |
427 } // namespace drive | 428 } // namespace drive |
OLD | NEW |