Loading mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorAndroidIntegration.java +14 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ public class TorAndroidIntegration implements BundleEventListener { private static final String EVENT_QUICKSTART_GET = "GeckoView:Tor:QuickstartGet"; private static final String EVENT_QUICKSTART_SET = "GeckoView:Tor:QuickstartSet"; private static final String EVENT_REGION_NAMES_GET = "GeckoView:Tor:RegionNamesGet"; private static final String EVENT_FREQUENT_REGION_NAMES_GET = "GeckoView:Tor:FrequentRegionNamesGet"; private static final String EVENT_SHOULD_SHOW_TOR_CONNECT = "GeckoView:Tor:ShouldShowTorConnect"; private static final String CONTROL_PORT_FILE = "/control-ipc"; Loading Loading @@ -709,6 +710,19 @@ public class TorAndroidIntegration implements BundleEventListener { }); } public interface FrequentRegionNamesGetter { void onValue(String[] frequentRegionNames); } public void frequentRegionNamesGet(FrequentRegionNamesGetter frequentRegionNamesGetter) { EventDispatcher.getInstance().queryBundle(EVENT_FREQUENT_REGION_NAMES_GET).then( frequentRegionNames -> { if (frequentRegionNames != null) { frequentRegionNamesGetter.onValue(frequentRegionNames.getStringArray("codes")); } return new GeckoResult<Void>(); }); } public interface ShouldShowTorConnectGetter { void onValue(Boolean shouldShowTorConnect); } Loading toolkit/modules/TorAndroidIntegration.sys.mjs +6 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ const ListenedEvents = Object.freeze({ quickstartGet: "GeckoView:Tor:QuickstartGet", quickstartSet: "GeckoView:Tor:QuickstartSet", regionNamesGet: "GeckoView:Tor:RegionNamesGet", frequentRegionNamesGet: "GeckoView:Tor:FrequentRegionNamesGet", shouldShowTorConnectGet: "GeckoView:Tor:ShouldShowTorConnect", }); Loading Loading @@ -213,6 +214,11 @@ class TorAndroidIntegrationImpl { case ListenedEvents.regionNamesGet: callback?.onSuccess(lazy.TorConnect.getRegionNames()); return; case ListenedEvents.frequentRegionNamesGet: callback?.onSuccess({ codes: await lazy.TorConnect.getFrequentRegions(), }); return; case ListenedEvents.shouldShowTorConnectGet: callback?.onSuccess(lazy.TorConnect.shouldShowTorConnect()); return; Loading Loading
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorAndroidIntegration.java +14 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ public class TorAndroidIntegration implements BundleEventListener { private static final String EVENT_QUICKSTART_GET = "GeckoView:Tor:QuickstartGet"; private static final String EVENT_QUICKSTART_SET = "GeckoView:Tor:QuickstartSet"; private static final String EVENT_REGION_NAMES_GET = "GeckoView:Tor:RegionNamesGet"; private static final String EVENT_FREQUENT_REGION_NAMES_GET = "GeckoView:Tor:FrequentRegionNamesGet"; private static final String EVENT_SHOULD_SHOW_TOR_CONNECT = "GeckoView:Tor:ShouldShowTorConnect"; private static final String CONTROL_PORT_FILE = "/control-ipc"; Loading Loading @@ -709,6 +710,19 @@ public class TorAndroidIntegration implements BundleEventListener { }); } public interface FrequentRegionNamesGetter { void onValue(String[] frequentRegionNames); } public void frequentRegionNamesGet(FrequentRegionNamesGetter frequentRegionNamesGetter) { EventDispatcher.getInstance().queryBundle(EVENT_FREQUENT_REGION_NAMES_GET).then( frequentRegionNames -> { if (frequentRegionNames != null) { frequentRegionNamesGetter.onValue(frequentRegionNames.getStringArray("codes")); } return new GeckoResult<Void>(); }); } public interface ShouldShowTorConnectGetter { void onValue(Boolean shouldShowTorConnect); } Loading
toolkit/modules/TorAndroidIntegration.sys.mjs +6 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ const ListenedEvents = Object.freeze({ quickstartGet: "GeckoView:Tor:QuickstartGet", quickstartSet: "GeckoView:Tor:QuickstartSet", regionNamesGet: "GeckoView:Tor:RegionNamesGet", frequentRegionNamesGet: "GeckoView:Tor:FrequentRegionNamesGet", shouldShowTorConnectGet: "GeckoView:Tor:ShouldShowTorConnect", }); Loading Loading @@ -213,6 +214,11 @@ class TorAndroidIntegrationImpl { case ListenedEvents.regionNamesGet: callback?.onSuccess(lazy.TorConnect.getRegionNames()); return; case ListenedEvents.frequentRegionNamesGet: callback?.onSuccess({ codes: await lazy.TorConnect.getFrequentRegions(), }); return; case ListenedEvents.shouldShowTorConnectGet: callback?.onSuccess(lazy.TorConnect.shouldShowTorConnect()); return; Loading