Disabling apps using the chrome.management API

南楼画角 提交于 2019-12-25 02:44:50

问题


Seems like something changed in Chrome, disabling apps via setting the enabled property of the ExtensionInfo object and via chrome.management.setEnabled() becomes meaningless.

The app icon does grey out in chrome://apps but clicking the grey out icon enables it automatically, the methods does not govern the state of the apps anymore. (But it still works fine for extensions)

I also noticed that apps no longer show up in chrome://extensions.

Is there any other undocumented way to get apps to stay disabled until the state is toggled by an extension?


回答1:


The behavior is working as intended. chrome.management.setEnabled() isn't meant to be a permanent policy operation; it's simply the equivalent of unchecking the "enabled" checkbox in the chrome://extensions list or in the Chrome Apps Developer Tool. Because the most reasonable interpretation of a click on an app icon is that the user wants to run the app, the system honors that request regardless of whether the app is enabled or disabled.

You might be wondering, then, what the "enabled" concept means for apps if it doesn't stop the user from running them. It does have a specific meaning: the item is in an unloaded state, so that its background page(s) cannot run to register event listeners or do other work. One purpose of the state is to help track down issues with poorly-behaved apps and extensions without going through the trouble of uninstalling and reinstalling them. If an item is disabled, then you know it can't be affecting your system anymore, so it's much easier to attribute bad behavior to that item (or else rule it out as the culprit).

If you want to stop yourself from launching an app, either uninstall it or stop clicking it. If you want to stop others from launching your apps, don't let them use your profile and instead guide them to setting up their own system-level user or Chrome user, or else let them use Guest Mode on a Chromebook. If you want to stop others from launching their apps, look into Chrome for Business, which lets you enforce administrator policies on machines that you legitimately control. If Chrome for Business doesn't make sense (for example because you're a parent simply wishing to stop your kids from messing around with certain things on your computer), try Chrome Supervised Users, which is designed specifically for that case.

Finally, if none of these solutions works for you, then you might want to re-examine your motives. You're asking for a lightweight operation (installing a Chrome App) to lead to a permanent change to the user's system (disabling other apps and preventing them from being re-enabled). Why would a user want that?



来源:https://stackoverflow.com/questions/22578084/disabling-apps-using-the-chrome-management-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!