| Index: components/download/internal/client_set.cc
|
| diff --git a/components/download/internal/client_set.cc b/components/download/internal/client_set.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f74834b0d9aca2e55a4e7b3c1a4c1fc6d6b3f1a0
|
| --- /dev/null
|
| +++ b/components/download/internal/client_set.cc
|
| @@ -0,0 +1,30 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/download/internal/client_set.h"
|
| +
|
| +namespace download {
|
| +
|
| +ClientSet::ClientSet(std::unique_ptr<DownloadClientMap> clients)
|
| + : clients_(std::move(clients)) {
|
| + DCHECK(clients_->find(DownloadClient::INVALID) == clients_->end());
|
| +}
|
| +
|
| +ClientSet::~ClientSet() = default;
|
| +
|
| +std::set<DownloadClient> ClientSet::GetRegisteredClients() const {
|
| + std::set<DownloadClient> clients;
|
| + for (const auto& it : *clients_) {
|
| + clients.insert(it.first);
|
| + }
|
| +
|
| + return clients;
|
| +}
|
| +
|
| +Client* ClientSet::GetClient(DownloadClient id) const {
|
| + const auto& it = clients_->find(id);
|
| + return it == clients_->end() ? nullptr : it->second.get();
|
| +}
|
| +
|
| +} // namespace download
|
|
|