1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et 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 mozilla_net_TRRServiceParent_h
8 #define mozilla_net_TRRServiceParent_h
9 
10 #include "mozilla/net/PTRRServiceParent.h"
11 #include "mozilla/net/TRRServiceBase.h"
12 #include "nsIObserver.h"
13 #include "nsWeakReference.h"
14 
15 namespace mozilla {
16 namespace net {
17 
18 class TRRServiceParent : public TRRServiceBase,
19                          public nsIObserver,
20                          public nsSupportsWeakReference,
21                          public PTRRServiceParent {
22  public:
23   NS_DECL_ISUPPORTS_INHERITED
24   NS_DECL_NSIOBSERVER
25   NS_DECL_NSIPROXYCONFIGCHANGEDCALLBACK
26 
27   TRRServiceParent() = default;
28   void Init();
29   void UpdateParentalControlEnabled();
30   static void PrefsChanged(const char* aName, void* aSelf);
31   void SetDetectedTrrURI(const nsACString& aURI);
32   bool MaybeSetPrivateURI(const nsACString& aURI) override;
33   void GetURI(nsACString& result) override;
34   mozilla::ipc::IPCResult RecvNotifyNetworkConnectivityServiceObservers(
35       const nsCString& aTopic);
36   mozilla::ipc::IPCResult RecvInitTRRConnectionInfo();
37   mozilla::ipc::IPCResult RecvSetConfirmationState(uint32_t aNewState);
GetConfirmationState()38   uint32_t GetConfirmationState() { return mConfirmationState; }
39   virtual void ReadEtcHostsFile() override;
40 
41  private:
42   virtual ~TRRServiceParent();
43   virtual void ActorDestroy(ActorDestroyReason why) override;
44   void prefsChanged(const char* aName);
45   void SetDefaultTRRConnectionInfo(nsHttpConnectionInfo* aConnInfo) override;
46   uint32_t mConfirmationState = 0;
47 };
48 
49 }  // namespace net
50 }  // namespace mozilla
51 
52 #endif  // mozilla_net_TRRServiceParent_h
53