#ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_FUCHSIA_H_
#define NET_BASE_NETWORK_CHANGE_NOTIFIER_FUCHSIA_H_
#include <fuchsia/net/interfaces/cpp/fidl.h>
#include <vector>
#include "base/threading/thread_checker.h"
#include "base/types/expected.h"
#include "net/base/fuchsia/network_interface_cache.h"
#include "net/base/net_export.h"
#include "net/base/network_change_notifier.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace net {
class SystemDnsConfigChangeNotifier;
class NET_EXPORT_PRIVATE NetworkChangeNotifierFuchsia
: public NetworkChangeNotifier {
public:
explicit NetworkChangeNotifierFuchsia(bool require_wlan);
NetworkChangeNotifierFuchsia(const NetworkChangeNotifierFuchsia&) = delete;
NetworkChangeNotifierFuchsia& operator=(const NetworkChangeNotifierFuchsia&) =
delete;
~NetworkChangeNotifierFuchsia() override;
ConnectionType GetCurrentConnectionType() const override;
private:
friend class NetworkChangeNotifierFuchsiaTest;
const internal::NetworkInterfaceCache* GetNetworkInterfaceCacheInternal()
const override;
NetworkChangeNotifierFuchsia(
fuchsia::net::interfaces::WatcherHandle watcher,
bool require_wlan,
SystemDnsConfigChangeNotifier* system_dns_config_notifier);
void OnInterfacesEvent(fuchsia::net::interfaces::Event event);
void HandleCacheStatus(
absl::optional<internal::NetworkInterfaceCache::ChangeBits> change_bits);
fuchsia::net::interfaces::WatcherPtr watcher_;
internal::NetworkInterfaceCache cache_;
THREAD_CHECKER(thread_checker_);
};
namespace internal {
fuchsia::net::interfaces::WatcherHandle ConnectInterfacesWatcher();
base::expected<fuchsia::net::interfaces::WatcherHandle, zx_status_t>
ReadExistingNetworkInterfacesFromNewWatcher(
fuchsia::net::interfaces::WatcherHandle watcher_handle,
std::vector<fuchsia::net::interfaces::Properties>& interfaces);
}
}
#endif