sessionMode: Drop allowExtensions property

Now that we allow extensions at the lock screens, extensions
are allowed for every session mode gnome-shell would typically
change to at runtime.

This means there's little advantage to having an allowExtensions
property in the session mode definition.

This commit simplifies the code a bit by dropping the property.

Third party session modes can still lock down extensions through
gsettings if they need to.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1967>
This commit is contained in:
Ray Strode 2021-09-28 15:31:11 -04:00 committed by Marge Bot
parent 2bf31dc49f
commit d7b1264897
2 changed files with 5 additions and 27 deletions

View File

@ -88,16 +88,6 @@ var ExtensionManager = class {
return false; return false;
} }
_sessionModeCanUseExtension(uuid) {
if (!Main.sessionMode.allowExtensions)
return false;
if (!this._extensionSupportsSessionMode(uuid))
return false;
return true;
}
_callExtensionDisable(uuid) { _callExtensionDisable(uuid) {
let extension = this.lookup(uuid); let extension = this.lookup(uuid);
if (!extension) if (!extension)
@ -157,7 +147,7 @@ var ExtensionManager = class {
} }
_callExtensionEnable(uuid) { _callExtensionEnable(uuid) {
if (!this._sessionModeCanUseExtension(uuid)) if (!this._extensionSupportsSessionMode(uuid))
return; return;
let extension = this.lookup(uuid); let extension = this.lookup(uuid);
@ -424,7 +414,7 @@ var ExtensionManager = class {
} }
_callExtensionInit(uuid) { _callExtensionInit(uuid) {
if (!this._sessionModeCanUseExtension(uuid)) if (!this._extensionSupportsSessionMode(uuid))
return false; return false;
let extension = this.lookup(uuid); let extension = this.lookup(uuid);
@ -635,17 +625,9 @@ var ExtensionManager = class {
} }
_sessionUpdated() { _sessionUpdated() {
// For now sessionMode.allowExtensions controls extensions from both the // Take care of added or removed sessionMode extensions
// 'enabled-extensions' preference and the sessionMode.enabledExtensions this._onEnabledExtensionsChanged();
// property; it might make sense to make enabledExtensions independent this._enableAllExtensions();
// from allowExtensions in the future
if (Main.sessionMode.allowExtensions) {
// Take care of added or removed sessionMode extensions
this._onEnabledExtensionsChanged();
this._enableAllExtensions();
} else {
this._disableAllExtensions();
}
} }
}; };
Signals.addSignalMethods(ExtensionManager.prototype); Signals.addSignalMethods(ExtensionManager.prototype);

View File

@ -20,7 +20,6 @@ const _modes = {
showCalendarEvents: false, showCalendarEvents: false,
showWelcomeDialog: false, showWelcomeDialog: false,
allowSettings: false, allowSettings: false,
allowExtensions: false,
allowScreencast: false, allowScreencast: false,
enabledExtensions: [], enabledExtensions: [],
hasRunDialog: false, hasRunDialog: false,
@ -42,7 +41,6 @@ const _modes = {
}, },
'gdm': { 'gdm': {
allowExtensions: true,
hasNotifications: true, hasNotifications: true,
isGreeter: true, isGreeter: true,
isPrimary: true, isPrimary: true,
@ -59,7 +57,6 @@ const _modes = {
}, },
'unlock-dialog': { 'unlock-dialog': {
allowExtensions: true,
isLocked: true, isLocked: true,
unlockDialog: undefined, unlockDialog: undefined,
components: ['polkitAgent', 'telepathyClient'], components: ['polkitAgent', 'telepathyClient'],
@ -76,7 +73,6 @@ const _modes = {
showCalendarEvents: true, showCalendarEvents: true,
showWelcomeDialog: true, showWelcomeDialog: true,
allowSettings: true, allowSettings: true,
allowExtensions: true,
allowScreencast: true, allowScreencast: true,
hasRunDialog: true, hasRunDialog: true,
hasWorkspaces: true, hasWorkspaces: true,