| 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/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 |
| OLD | NEW |