[chrome-gnome-shell] api: expose "disable-user-extensions" Shell setting.



commit c48b36c089ea18a1c600c325b12cfdbc3548f2a9
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Sun Jan 6 16:10:36 2019 +0400

    api: expose "disable-user-extensions" Shell setting.
    
    Bug: https://gitlab.gnome.org/GNOME/chrome-gnome-shell/issues/2
    See-Also: https://bugzilla.gnome.org/show_bug.cgi?id=778664
    See-Also: https://gitlab.gnome.org/GNOME/gnome-shell/commit/7395aaf9b45690bbee232852a39d3b3595aa6d99

 connector/chrome-gnome-shell.py     | 7 +++++++
 extension/include/sweettooth-api.js | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/connector/chrome-gnome-shell.py b/connector/chrome-gnome-shell.py
index 0bde4dd..7914af3 100755
--- a/connector/chrome-gnome-shell.py
+++ b/connector/chrome-gnome-shell.py
@@ -35,6 +35,7 @@ DEBUG_ENABLED = False
 SHELL_SCHEMA = "org.gnome.shell"
 ENABLED_EXTENSIONS_KEY = "enabled-extensions"
 EXTENSION_DISABLE_VERSION_CHECK_KEY = "disable-extension-version-validation"
+DISABLE_USER_EXTENSIONS_KEY = "disable-user-extensions"
 
 # https://developer.chrome.com/extensions/nativeMessaging#native-messaging-host-protocol
 MESSAGE_LENGTH_SIZE = 4
@@ -371,6 +372,11 @@ class ChromeGNOMEShell(Gio.Application):
                 else:
                     disable_version_check = False
 
+                if DISABLE_USER_EXTENSIONS_KEY in settings.keys():
+                    disable_user_extensions = settings.get_boolean(DISABLE_USER_EXTENSIONS_KEY)
+                else:
+                    disable_user_extensions = False
+
                 supports = ['notifications', "update-enabled"]
                 if REQUESTS_IMPORTED:
                     supports.append('update-check')
@@ -382,6 +388,7 @@ class ChromeGNOMEShell(Gio.Application):
                             'connectorVersion': CONNECTOR_VERSION,
                             'shellVersion': shell_version.unpack() if shell_version is not None else None,
                             'versionValidationEnabled': not disable_version_check,
+                            'userExtensionsDisabled': disable_user_extensions,
                             'supports': supports
                         }
                     }
diff --git a/extension/include/sweettooth-api.js b/extension/include/sweettooth-api.js
index f996954..c1c4f31 100644
--- a/extension/include/sweettooth-api.js
+++ b/extension/include/sweettooth-api.js
@@ -28,9 +28,10 @@ GSC.getMessage = function (key) {
 
 window.SweetTooth = function () {
        var apiObject = {
-               apiVersion: 5,
+               apiVersion: 6,
                shellVersion: '-1',
                versionValidationEnabled: true,
+               userExtensionsDisabled: false,
 
                getChromeExtensionId: function () {
                        return GS_CHROME_ID;
@@ -87,6 +88,7 @@ window.SweetTooth = function () {
                        ready.then(function (response) {
                                apiObject.shellVersion = response.shellVersion;
                                apiObject.versionValidationEnabled = response.versionValidationEnabled;
+                               apiObject.userExtensionsDisabled = response.userExtensionsDisabled;
 
                                let REQUIRED_APIS = [
                                        "notifications"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]