This repository was archived by the owner on Jul 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +37
-1
lines changed
common/shared/org/mozilla/vrbrowser Expand file tree Collapse file tree 6 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -967,6 +967,24 @@ public void setRemoteDebugging(final boolean enabled) {
967967 }
968968 }
969969
970+ public void setAutoplayEnabled (final boolean enabled ) {
971+ if (mRuntime != null ) {
972+ mRuntime .getSettings ().setAutoplayDefault (enabled ?
973+ GeckoRuntimeSettings .AUTOPLAY_DEFAULT_ALLOWED :
974+ GeckoRuntimeSettings .AUTOPLAY_DEFAULT_BLOCKED );
975+ }
976+ }
977+
978+ public boolean getAutoplayEnabled () {
979+ if (mRuntime != null ) {
980+ return mRuntime .getSettings ().getAutoplayDefault () == GeckoRuntimeSettings .AUTOPLAY_DEFAULT_ALLOWED ?
981+ true :
982+ false ;
983+ }
984+
985+ return false ;
986+ }
987+
970988 // NavigationDelegate
971989
972990 @ Override
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ public boolean isChecked() {
9494
9595 public void setChecked (boolean value ) {
9696 mSwitch .setChecked (value );
97+ updateSwitchText ();
9798 }
9899
99100
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class PrivacyOptionsView extends SettingsView {
2727 private AudioEngine mAudio ;
2828 private UIButton mBackButton ;
2929 private SwitchSetting mTrackingSetting ;
30+ private SwitchSetting mAutoplaySetting ;
3031 private ButtonSetting mResetButton ;
3132 private ArrayList <Pair <ButtonSetting , String >> mPermissionButtons ;
3233 private int mAlertDialogHandle ;
@@ -73,6 +74,12 @@ private void initialize(Context aContext) {
7374 SessionStore .get ().setTrackingProtection (enabled );
7475 });
7576
77+ mAutoplaySetting = findViewById (R .id .autoplaySwitch );
78+ mAutoplaySetting .setChecked (SessionStore .get ().getAutoplayEnabled ());
79+ mAutoplaySetting .setOnCheckedChangeListener ((compoundButton , enabled , apply ) -> {
80+ SessionStore .get ().setAutoplayEnabled (enabled );
81+ });
82+
7683 TextView permissionsTitleText = findViewById (R .id .permissionsTitle );
7784 permissionsTitleText .setText (getContext ().getString (R .string .security_options_permissions_title , getContext ().getString (R .string .app_name )));
7885
Original file line number Diff line number Diff line change 5858 android : layout_height =" wrap_content"
5959 app : description =" @string/security_options_tracking_protection" />
6060
61+ <org .mozilla.vrbrowser.ui.views.settings.SwitchSetting
62+ android : id =" @+id/autoplaySwitch"
63+ android : layout_width =" match_parent"
64+ android : layout_height =" wrap_content"
65+ app : description =" @string/security_options_autoplay" />
66+
6167 <TextView
6268 android : id =" @+id/permissionsTitle"
6369 style =" @style/settingsDescription"
Original file line number Diff line number Diff line change 1111 <string name =" settings_key_console_logs" translatable =" false" >settings_console_logs</string >
1212 <string name =" settings_key_environment_override" translatable =" false" >settings_environment_override</string >
1313 <string name =" settings_key_multiprocess" translatable =" false" >settings_environment_multiprocess</string >
14- <string name =" settings_key_servo" >settings_environment_servo</string >
14+ <string name =" settings_key_servo" translatable = " false " >settings_environment_servo</string >
1515 <string name =" settings_key_tracking_protection" translatable =" false" >settings_tracking_protection</string >
1616 <string name =" settings_key_user_agent_version" translatable =" false" >settings_user_agent_version</string >
1717 <string name =" settings_key_input_mode" translatable =" false" >settings_touch_mode</string >
Original file line number Diff line number Diff line change 377377 and is used to enable or disable tracking protection. -->
378378 <string name =" security_options_tracking_protection" >Tracking Protection</string >
379379
380+ <!-- This string labels an On/Off switch in the Privacy and Security settings dialog
381+ and is used to enable or disable media autoplay. -->
382+ <string name =" security_options_autoplay" >Autoplay Media</string >
383+
380384 <!-- This string is a label above the group of buttons that indicates that the buttons below
381385 relate to Android system permissions granted to the app.
382386 '%1$s' will be replaced at runtime with the app's name. -->
You can’t perform that action at this time.
0 commit comments