зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1621913 Don't show the defaultBrowserBox in settings under flatpak; r=settings-reviewers,Gijs
Under Flatpak we cannot determine if the application is set as default handler for http/https protocols and also the application cannot set the system defaults. In order to avoid user confusion we hide the defaultBrowserBox which under flatpak shows always: "Firefox is not your default browser" and the "Make Default..." button does not make any change to the system. Differential Revision: https://phabricator.services.mozilla.com/D170590
This commit is contained in:
Родитель
1ffcde03df
Коммит
e42200263f
|
@ -1269,7 +1269,9 @@ var gMainPane = {
|
|||
if (AppConstants.HAVE_SHELL_SERVICE) {
|
||||
let shellSvc = getShellService();
|
||||
let defaultBrowserBox = document.getElementById("defaultBrowserBox");
|
||||
if (!shellSvc) {
|
||||
let isInFlatpak = gGIOService?.isRunningUnderFlatpak;
|
||||
// Flatpak does not support setting nor detection of default browser
|
||||
if (!shellSvc || isInFlatpak) {
|
||||
defaultBrowserBox.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
@ -2454,11 +2456,8 @@ var gMainPane = {
|
|||
possibleAppMenuItems.push(menuItem);
|
||||
}
|
||||
// Add gio handlers
|
||||
if (Cc["@mozilla.org/gio-service;1"]) {
|
||||
let gIOSvc = Cc["@mozilla.org/gio-service;1"].getService(
|
||||
Ci.nsIGIOService
|
||||
);
|
||||
var gioApps = gIOSvc.getAppsForURIScheme(handlerInfo.type);
|
||||
if (gGIOService) {
|
||||
var gioApps = gGIOService.getAppsForURIScheme(handlerInfo.type);
|
||||
let possibleHandlers = handlerInfo.possibleApplicationHandlers;
|
||||
for (let handler of gioApps.enumerate(Ci.nsIHandlerApp)) {
|
||||
// OS handler share the same name, it's most likely the same app, skipping...
|
||||
|
|
|
@ -68,6 +68,17 @@ XPCOMUtils.defineLazyServiceGetters(this, {
|
|||
gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"],
|
||||
});
|
||||
|
||||
if (Cc["@mozilla.org/gio-service;1"]) {
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
"gGIOService",
|
||||
"@mozilla.org/gio-service;1",
|
||||
"nsIGIOService"
|
||||
);
|
||||
} else {
|
||||
this.gGIOService = null;
|
||||
}
|
||||
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
|
||||
ContextualIdentityService:
|
||||
|
|
|
@ -702,6 +702,11 @@ nsresult nsGIOService::LaunchFile(const nsACString& aPath) {
|
|||
return LaunchPath(aPath);
|
||||
}
|
||||
|
||||
nsresult nsGIOService::GetIsRunningUnderFlatpak(bool* aResult) {
|
||||
*aResult = mozilla::widget::IsRunningUnderFlatpak();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult RevealDirectory(nsIFile* aFile, bool aForce) {
|
||||
nsAutoCString path;
|
||||
if (bool isDir; NS_SUCCEEDED(aFile->IsDirectory(&isDir)) && isDir) {
|
||||
|
|
|
@ -75,6 +75,7 @@ interface nsIGIOService : nsISupports
|
|||
AUTF8String getDescriptionForMimeType(in AUTF8String mimeType);
|
||||
|
||||
/*** Misc. methods ***/
|
||||
[infallible] readonly attribute boolean isRunningUnderFlatpak;
|
||||
|
||||
/* Open the given URI in the default application */
|
||||
[noscript] void showURI(in nsIURI uri);
|
||||
|
|
Загрузка…
Ссылка в новой задаче