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

Side by Side Diff: components/download/internal/client_set.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/client_set.h"
6
7 namespace download {
8
9 ClientSet::ClientSet(std::unique_ptr<DownloadClientMap> clients)
10 : clients_(std::move(clients)) {
11 DCHECK(clients_->find(DownloadClient::INVALID) == clients_->end());
12 }
13
14 ClientSet::~ClientSet() = default;
15
16 std::set<DownloadClient> ClientSet::GetRegisteredClients() const {
17 std::set<DownloadClient> clients;
18 for (const auto& it : *clients_) {
19 clients.insert(it.first);
20 }
21
22 return clients;
23 }
24
25 Client* ClientSet::GetClient(DownloadClient id) const {
26 const auto& it = clients_->find(id);
27 return it == clients_->end() ? nullptr : it->second.get();
28 }
29
30 } // namespace download
OLDNEW
« no previous file with comments | « components/download/internal/client_set.h ('k') | components/download/internal/client_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698