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 "components/drive/chromeos/file_system/search_operation.h" | 5 #include "components/drive/chromeos/file_system/search_operation.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 |
| 9 #include <memory> |
8 #include <string> | 10 #include <string> |
9 #include <utility> | 11 #include <utility> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/bind.h" | 14 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 16 #include "base/callback.h" |
15 #include "base/task_runner_util.h" | 17 #include "base/task_runner_util.h" |
16 #include "components/drive/chromeos/change_list_loader.h" | 18 #include "components/drive/chromeos/change_list_loader.h" |
17 #include "components/drive/chromeos/resource_metadata.h" | 19 #include "components/drive/chromeos/resource_metadata.h" |
(...skipping 12 matching lines...) Expand all Loading... |
30 // and stores to |result|, by using |resource_metadata|. If the metadata is not | 32 // and stores to |result|, by using |resource_metadata|. If the metadata is not |
31 // up to date and did not contain an item, adds the item to "drive/other" for | 33 // up to date and did not contain an item, adds the item to "drive/other" for |
32 // temporally assigning a path. | 34 // temporally assigning a path. |
33 FileError ResolveSearchResultOnBlockingPool( | 35 FileError ResolveSearchResultOnBlockingPool( |
34 internal::ResourceMetadata* resource_metadata, | 36 internal::ResourceMetadata* resource_metadata, |
35 std::unique_ptr<google_apis::FileList> file_list, | 37 std::unique_ptr<google_apis::FileList> file_list, |
36 std::vector<SearchResultInfo>* result) { | 38 std::vector<SearchResultInfo>* result) { |
37 DCHECK(resource_metadata); | 39 DCHECK(resource_metadata); |
38 DCHECK(result); | 40 DCHECK(result); |
39 | 41 |
40 const ScopedVector<google_apis::FileResource>& entries = file_list->items(); | 42 const std::vector<std::unique_ptr<google_apis::FileResource>>& entries = |
| 43 file_list->items(); |
41 result->reserve(entries.size()); | 44 result->reserve(entries.size()); |
42 for (size_t i = 0; i < entries.size(); ++i) { | 45 for (size_t i = 0; i < entries.size(); ++i) { |
43 std::string local_id; | 46 std::string local_id; |
44 FileError error = resource_metadata->GetIdByResourceId( | 47 FileError error = resource_metadata->GetIdByResourceId( |
45 entries[i]->file_id(), &local_id); | 48 entries[i]->file_id(), &local_id); |
46 | 49 |
47 ResourceEntry entry; | 50 ResourceEntry entry; |
48 if (error == FILE_ERROR_OK) | 51 if (error == FILE_ERROR_OK) |
49 error = resource_metadata->GetResourceEntryById(local_id, &entry); | 52 error = resource_metadata->GetResourceEntryById(local_id, &entry); |
50 | 53 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 callback.Run(error, GURL(), | 173 callback.Run(error, GURL(), |
171 std::unique_ptr<std::vector<SearchResultInfo>>()); | 174 std::unique_ptr<std::vector<SearchResultInfo>>()); |
172 return; | 175 return; |
173 } | 176 } |
174 | 177 |
175 callback.Run(error, next_link, std::move(result)); | 178 callback.Run(error, next_link, std::move(result)); |
176 } | 179 } |
177 | 180 |
178 } // namespace file_system | 181 } // namespace file_system |
179 } // namespace drive | 182 } // namespace drive |
OLD | NEW |