Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: components/download/internal/entry_utils.cc

Issue 2895953004: Add initial Controller to DownloadService (Closed)
Patch Set: Rebased Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « components/download/internal/entry_utils.h ('k') | components/download/internal/entry_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698