Bug 1234238 - Restore FFB theme. r=sebastian
--- a/mobile/android/base/java/org/mozilla/gecko/restrictions/GuestProfileConfiguration.java
+++ b/mobile/android/base/java/org/mozilla/gecko/restrictions/GuestProfileConfiguration.java
@@ -21,17 +21,18 @@ public class GuestProfileConfiguration i
Restrictable.BROWSE,
Restrictable.SHARE,
Restrictable.BOOKMARK,
Restrictable.ADD_CONTACT,
Restrictable.SET_IMAGE,
Restrictable.MODIFY_ACCOUNTS,
Restrictable.REMOTE_DEBUGGING,
Restrictable.IMPORT_SETTINGS,
- Restrictable.BLOCK_LIST
+ Restrictable.BLOCK_LIST,
+ Restrictable.DEFAULT_THEME
);
@SuppressWarnings("serial")
private static final List<String> BANNED_SCHEMES = Arrays.asList(
"file",
"chrome",
"resource",
"jar",
--- a/mobile/android/base/java/org/mozilla/gecko/restrictions/Restrictable.java
+++ b/mobile/android/base/java/org/mozilla/gecko/restrictions/Restrictable.java
@@ -65,17 +65,19 @@ public enum Restrictable {
R.string.restrictable_feature_advanced_settings_description),
CAMERA_MICROPHONE(18, "camera_microphone",
R.string.restrictable_feature_camera_microphone,
R.string.restrictable_feature_camera_microphone_description),
BLOCK_LIST(19, "block_list",
R.string.restrictable_feature_block_list,
- R.string.restrictable_feature_block_list_description);
+ R.string.restrictable_feature_block_list_description),
+
+ DEFAULT_THEME(20, "default_theme", 0, 0);
public final int id;
public final String name;
@StringRes
public final int title;
@StringRes
--- a/mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictedProfileConfiguration.java
+++ b/mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictedProfileConfiguration.java
@@ -34,24 +34,27 @@ public class RestrictedProfileConfigurat
configuration.put(Restrictable.ADVANCED_SETTINGS, false);
configuration.put(Restrictable.CAMERA_MICROPHONE, false);
configuration.put(Restrictable.DATA_CHOICES, true);
// Hold behind Nightly flag until we have an actual block list deployed.
if (AppConstants.NIGHTLY_BUILD) {
configuration.put(Restrictable.BLOCK_LIST, false);
}
+
+ configuration.put(Restrictable.DEFAULT_THEME, true);
}
/**
* These restrictions are hidden from the admin configuration UI.
*/
private static List<Restrictable> hiddenRestrictions = Arrays.asList(
Restrictable.MASTER_PASSWORD,
- Restrictable.GUEST_BROWSING
+ Restrictable.GUEST_BROWSING,
+ Restrictable.DEFAULT_THEME
);
/* package-private */ static boolean shouldHide(Restrictable restrictable) {
return hiddenRestrictions.contains(restrictable);
}
/* package-private */ static Map<Restrictable, Boolean> getConfiguration() {
return configuration;
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3116,16 +3116,23 @@ XPCOMUtils.defineLazyModuleGetter(this,
var LightWeightThemeWebInstaller = {
init: function sh_init() {
let temp = {};
Cu.import("resource://gre/modules/LightweightThemeConsumer.jsm", temp);
let theme = new temp.LightweightThemeConsumer(document);
BrowserApp.deck.addEventListener("InstallBrowserTheme", this, false, true);
BrowserApp.deck.addEventListener("PreviewBrowserTheme", this, false, true);
BrowserApp.deck.addEventListener("ResetBrowserThemePreview", this, false, true);
+
+ if (ParentalControls.parentalControlsEnabled &&
+ !this._manager.currentTheme &&
+ ParentalControls.isAllowed(ParentalControls.DEFAULT_THEME)) {
+ // We are using the DEFAULT_THEME restriction to differentiate between restricted profiles & guest mode - Bug 1199596
+ this._installParentalControlsTheme();
+ }
},
handleEvent: function (event) {
switch (event.type) {
case "InstallBrowserTheme":
case "PreviewBrowserTheme":
case "ResetBrowserThemePreview":
// ignore requests from background tabs
@@ -3152,16 +3159,28 @@ var LightWeightThemeWebInstaller = {
get _manager () {
let temp = {};
Cu.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
delete this._manager;
return this._manager = temp.LightweightThemeManager;
},
+ _installParentalControlsTheme: function() {
+ let mgr = this._manager;
+ let parentalControlsTheme = {
+ "headerURL": "resource://android/assets/parental_controls_theme.png",
+ "name": "Parental Controls Theme",
+ "id": "parental-controls-theme@mozilla.org"
+ };
+
+ mgr.addBuiltInTheme(parentalControlsTheme);
+ mgr.themeChanged(parentalControlsTheme);
+ },
+
_installRequest: function (event) {
let node = event.target;
let data = this._getThemeFromNode(node);
if (!data)
return;
if (this._isAllowed(node)) {
this._install(data);
--- a/toolkit/components/parentalcontrols/nsIParentalControlsService.idl
+++ b/toolkit/components/parentalcontrols/nsIParentalControlsService.idl
@@ -6,17 +6,17 @@
#include "nsISupports.idl"
interface nsIURI;
interface nsIFile;
interface nsIInterfaceRequestor;
interface nsIArray;
-[scriptable, uuid(f17414cd-d357-476d-b894-2f7bda9e3a9b)]
+[scriptable, uuid(60f8615b-573d-4503-8e0f-36e739049692)]
interface nsIParentalControlsService : nsISupports
{
/**
* Action types that can be blocked for users.
*/
const short DOWNLOAD = 1; // Downloading files
const short INSTALL_EXTENSION = 2; // Installing extensions
const short INSTALL_APP = 3; // Installing webapps
@@ -31,16 +31,17 @@ interface nsIParentalControlsService : n
const short PRIVATE_BROWSING = 12; // Disallow usage of private browsing
const short DATA_CHOICES = 13; // Choose whether or not to send usage information
const short CLEAR_HISTORY = 14; // Clear browsing history
const short MASTER_PASSWORD = 15; // Setting master password for logins
const short GUEST_BROWSING = 16; // Disallow usage of guest browsing
const short ADVANCED_SETTINGS = 17; // Advanced settings
const short CAMERA_MICROPHONE = 18; // Camera and microphone (WebRTC)
const short BLOCK_LIST = 19; // Block websites that include sensitive content
+ const short DEFAULT_THEME = 20; // Use default theme or a special parental controls theme
/**
* @returns true if the current user account has parental controls
* restrictions enabled.
*/
readonly attribute boolean parentalControlsEnabled;
/**