Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
5a42ab81
Commit
5a42ab81
authored
7 months ago
by
clairehurst
Committed by
Pier Angelo Vendrame
6 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fixup! TB 42247: Android helpers for the TorProvider
Bug 41188: Wire up stages to UI
parent
ec26bc8b
No related branches found
No related tags found
1 merge request
!1500
TB 43415: Rebased onto 134.0a1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorAndroidIntegration.java
+27
-0
27 additions, 0 deletions
...ain/java/org/mozilla/geckoview/TorAndroidIntegration.java
toolkit/modules/TorAndroidIntegration.sys.mjs
+8
-2
8 additions, 2 deletions
toolkit/modules/TorAndroidIntegration.sys.mjs
with
35 additions
and
2 deletions
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorAndroidIntegration.java
+
27
−
0
View file @
5a42ab81
...
...
@@ -53,8 +53,10 @@ public class TorAndroidIntegration implements BundleEventListener {
private
static
final
String
EVENT_BOOTSTRAP_BEGIN_AUTO
=
"GeckoView:Tor:BootstrapBeginAuto"
;
private
static
final
String
EVENT_BOOTSTRAP_CANCEL
=
"GeckoView:Tor:BootstrapCancel"
;
private
static
final
String
EVENT_BOOTSTRAP_GET_STATE
=
"GeckoView:Tor:BootstrapGetState"
;
private
static
final
String
EVENT_START_AGAIN
=
"GeckoView:Tor:StartAgain"
;
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_COUNTRY_NAMES_GET
=
"GeckoView:Tor:CountryNamesGet"
;
private
static
final
String
CONTROL_PORT_FILE
=
"/control-ipc"
;
private
static
final
String
SOCKS_FILE
=
"/socks-ipc"
;
...
...
@@ -693,6 +695,10 @@ public class TorAndroidIntegration implements BundleEventListener {
return
EventDispatcher
.
getInstance
().
queryVoid
(
EVENT_SETTINGS_SET
,
bundle
);
}
public
@NonNull
GeckoResult
<
Void
>
startAgain
()
{
return
EventDispatcher
.
getInstance
().
queryVoid
(
EVENT_START_AGAIN
);
}
public
interface
QuickstartGetter
{
void
onValue
(
boolean
enabled
);
}
...
...
@@ -710,6 +716,27 @@ public class TorAndroidIntegration implements BundleEventListener {
return
EventDispatcher
.
getInstance
().
queryVoid
(
EVENT_QUICKSTART_SET
,
bundle
);
}
public
interface
CountryNamesGetter
{
void
onValue
(
Map
<
String
,
String
>
regions
);
}
public
void
countryNamesGet
(
CountryNamesGetter
countryNamesGetter
)
{
EventDispatcher
.
getInstance
().
queryBundle
(
EVENT_COUNTRY_NAMES_GET
).
then
(
countryNames
->
{
if
(
countryNames
!=
null
)
{
String
[]
codes
=
countryNames
.
keys
();
Map
<
String
,
String
>
regions
=
new
HashMap
<>(
codes
.
length
);
for
(
String
code
:
codes
)
{
regions
.
put
(
code
,
countryNames
.
getString
(
code
));
}
countryNamesGetter
.
onValue
(
regions
);
}
else
{
Log
.
e
(
TAG
,
"countryNames was null"
);
countryNamesGetter
.
onValue
(
null
);
}
return
new
GeckoResult
<
Void
>();
});
}
public
@NonNull
GeckoResult
<
Void
>
beginBootstrap
()
{
return
EventDispatcher
.
getInstance
().
queryVoid
(
EVENT_BOOTSTRAP_BEGIN
);
}
...
...
...
...
This diff is collapsed.
Click to expand it.
toolkit/modules/TorAndroidIntegration.sys.mjs
+
8
−
2
View file @
5a42ab81
...
...
@@ -42,8 +42,10 @@ const ListenedEvents = Object.freeze({
bootstrapBeginAuto
:
"
GeckoView:Tor:BootstrapBeginAuto
"
,
bootstrapCancel
:
"
GeckoView:Tor:BootstrapCancel
"
,
bootstrapGetState
:
"
GeckoView:Tor:BootstrapGetState
"
,
startAgain
:
"
GeckoView:Tor:StartAgain
"
,
quickstartGet
:
"
GeckoView:Tor:QuickstartGet
"
,
quickstartSet
:
"
GeckoView:Tor:QuickstartSet
"
,
countryNamesGet
:
"
GeckoView:Tor:CountryNamesGet
"
,
});
class
TorAndroidIntegrationImpl
{
...
...
@@ -190,14 +192,18 @@ class TorAndroidIntegrationImpl {
case
ListenedEvents
.
bootstrapGetState
:
callback
?.
onSuccess
(
lazy
.
TorConnect
.
state
);
return
;
// TODO: Expose TorConnect.startAgain() to allow users to begin
// from the start again.
case
ListenedEvents
.
startAgain
:
lazy
.
TorConnect
.
startAgain
();
break
;
case
ListenedEvents
.
quickstartGet
:
callback
?.
onSuccess
(
lazy
.
TorConnect
.
quickstart
);
return
;
case
ListenedEvents
.
quickstartSet
:
lazy
.
TorConnect
.
quickstart
=
data
.
enabled
;
break
;
case
ListenedEvents
.
countryNamesGet
:
callback
?.
onSuccess
(
lazy
.
TorConnect
.
countryNames
)
return
;
}
callback
?.
onSuccess
();
}
catch
(
e
)
{
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment