| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/download/internal/entry_utils.h" |
| 6 |
| 7 #include "components/download/internal/entry.h" |
| 8 |
| 9 namespace download { |
| 10 namespace util { |
| 11 |
| 12 uint32_t GetNumberOfEntriesForClient(DownloadClient client, |
| 13 const std::vector<Entry*>& entries) { |
| 14 uint32_t count = 0; |
| 15 for (auto* entry : entries) |
| 16 if (entry->client == client) |
| 17 count++; |
| 18 |
| 19 return count; |
| 20 } |
| 21 |
| 22 std::map<DownloadClient, std::vector<std::string>> MapEntriesToClients( |
| 23 const std::set<DownloadClient>& clients, |
| 24 const std::vector<Entry*>& entries) { |
| 25 std::map<DownloadClient, std::vector<std::string>> categorized; |
| 26 |
| 27 for (auto* entry : entries) { |
| 28 DownloadClient client = entry->client; |
| 29 if (clients.find(client) == clients.end()) |
| 30 client = DownloadClient::INVALID; |
| 31 |
| 32 categorized[client].push_back(entry->guid); |
| 33 } |
| 34 |
| 35 return categorized; |
| 36 } |
| 37 |
| 38 } // namespace util |
| 39 } // namespace download |
| OLD | NEW |