tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsAndroidNetworkLinkService.h (1402B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef NSANDROIDNETWORKLINKSERVICE_H_
      8 #define NSANDROIDNETWORKLINKSERVICE_H_
      9 
     10 #include "nsINetworkLinkService.h"
     11 #include "nsIObserver.h"
     12 #include "../netlink/NetlinkService.h"
     13 
     14 class nsAndroidNetworkLinkService
     15    : public nsINetworkLinkService,
     16      public nsIObserver,
     17      public mozilla::net::NetlinkServiceListener {
     18 public:
     19  NS_DECL_THREADSAFE_ISUPPORTS
     20  NS_DECL_NSINETWORKLINKSERVICE
     21  NS_DECL_NSIOBSERVER
     22 
     23  nsAndroidNetworkLinkService();
     24 
     25  nsresult Init();
     26 
     27  void OnNetworkChanged() override;
     28  void OnNetworkIDChanged() override;
     29  void OnLinkUp() override;
     30  void OnLinkDown() override;
     31  void OnLinkStatusKnown() override;
     32  void OnDnsSuffixListUpdated() override;
     33 
     34 private:
     35  virtual ~nsAndroidNetworkLinkService() = default;
     36 
     37  // Called when xpcom-shutdown-threads is received.
     38  nsresult Shutdown();
     39 
     40  // Sends the network event.
     41  void NotifyObservers(const char* aTopic, const char* aData);
     42 
     43  mozilla::Atomic<bool, mozilla::Relaxed> mStatusIsKnown;
     44 
     45  RefPtr<mozilla::net::NetlinkService> mNetlinkSvc;
     46 };
     47 
     48 #endif /* NSANDROIDNETWORKLINKSERVICE_H_ */