chromium/services/network/public/cpp/network_connection_tracker.h

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SERVICES_NETWORK_PUBLIC_CPP_NETWORK_CONNECTION_TRACKER_H_
#define SERVICES_NETWORK_PUBLIC_CPP_NETWORK_CONNECTION_TRACKER_H_

#include <list>
#include <memory>

#include "base/atomicops.h"
#include "base/component_export.h"
#include "base/functional/callback.h"
#include "base/gtest_prod_util.h"
#include "base/observer_list_threadsafe.h"
#include "base/scoped_observation_traits.h"
#include "base/sequence_checker.h"
#include "base/synchronization/lock.h"
#include "base/task/sequenced_task_runner.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/network/public/mojom/network_change_manager.mojom.h"

namespace network {

// Defines the type of a callback that will return a NetworkConnectionTracker
// instance.
class NetworkConnectionTracker;
NetworkConnectionTrackerGetter;
// Defines the type of a callback that can be used to asynchronously get a
// NetworkConnectionTracker instance.
NetworkConnectionTrackerAsyncGetter;

// This class subscribes to network change events from
// network::mojom::NetworkChangeManager and propogates these notifications to
// its NetworkConnectionObservers registered through
// AddNetworkConnectionObserver()/RemoveNetworkConnectionObserver().
class COMPONENT_EXPORT(NETWORK_CPP) NetworkConnectionTracker
    : public network::mojom::NetworkChangeManagerClient {};

}  // namespace network

namespace base {

template <>
struct ScopedObservationTraits<
    network::NetworkConnectionTracker,
    network::NetworkConnectionTracker::NetworkConnectionObserver> {};

}  // namespace base

#endif  // SERVICES_NETWORK_PUBLIC_CPP_NETWORK_CONNECTION_TRACKER_H_