mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 1411589 - Export ShouldUseFlatpakPortal(); r=stransky
We need to detect the flatpak environment on multiple places. Making the ShouldUseFlatpakPortal() exported to the nsIGIOService allows us to reuse it. MozReview-Commit-ID: 41NJyR3fqZQ --HG-- extra : rebase_source : 4ebb9ba2ff98d3c6d924223485e028929eb801ed
This commit is contained in:
parent
1e102399e8
commit
bda48ed89f
@ -37,7 +37,7 @@ static bool GetShouldUseFlatpakPortal() {
|
||||
return shouldUsePortal;
|
||||
}
|
||||
|
||||
static bool ShouldUseFlatpakPortal() {
|
||||
static bool ShouldUseFlatpakPortalImpl() {
|
||||
static bool sShouldUseFlatpakPortal = GetShouldUseFlatpakPortal();
|
||||
return sShouldUseFlatpakPortal;
|
||||
}
|
||||
@ -456,7 +456,7 @@ nsGIOService::GetAppForURIScheme(const nsACString& aURIScheme,
|
||||
// Application in flatpak sandbox does not have access to the list
|
||||
// of installed applications on the system. We use generic
|
||||
// nsFlatpakHandlerApp which forwards launch call to the system.
|
||||
if (ShouldUseFlatpakPortal()) {
|
||||
if (ShouldUseFlatpakPortalImpl()) {
|
||||
nsFlatpakHandlerApp *mozApp = new nsFlatpakHandlerApp();
|
||||
NS_ADDREF(*aApp = mozApp);
|
||||
return NS_OK;
|
||||
@ -515,7 +515,7 @@ nsGIOService::GetAppForMimeType(const nsACString& aMimeType,
|
||||
|
||||
// Flatpak does not reveal installed application to the sandbox,
|
||||
// we need to create generic system handler.
|
||||
if (ShouldUseFlatpakPortal()) {
|
||||
if (ShouldUseFlatpakPortalImpl()) {
|
||||
nsFlatpakHandlerApp *mozApp = new nsFlatpakHandlerApp();
|
||||
NS_ADDREF(*aApp = mozApp);
|
||||
return NS_OK;
|
||||
@ -744,3 +744,10 @@ nsGIOService::CreateAppFromCommand(nsACString const& cmd,
|
||||
NS_ADDREF(*appInfo = mozApp);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGIOService::ShouldUseFlatpakPortal(bool* aRes)
|
||||
{
|
||||
*aRes = ShouldUseFlatpakPortalImpl();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -81,6 +81,10 @@ interface nsIGIOService : nsISupports
|
||||
|
||||
/* Open path in file manager using org.freedesktop.FileManager1 interface */
|
||||
[noscript] void orgFreedesktopFileManager1ShowItems(in ACString path);
|
||||
|
||||
/* Check if we're in flatpak runtime or using GTK portals has been enforced */
|
||||
[noscript] bool shouldUseFlatpakPortal();
|
||||
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
Loading…
Reference in New Issue
Block a user