1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef DBusService_h__
7 #define DBusService_h__
11 #include "mozilla/RefPtr.h"
12 #include "mozilla/GRefPtr.h"
14 namespace mozilla::widget
{
16 class DBusService final
{
18 explicit DBusService(const char* aAppFile
) : mAppFile(aAppFile
) {}
21 // nsBaseAppShell overrides:
25 void StartDBusListening();
26 void StopDBusListening();
28 static void DBusSessionSleepCallback(GDBusProxy
* aProxy
, gchar
* aSenderName
,
30 GVariant
* aParameters
,
32 static void DBusTimedatePropertiesChangedCallback(GDBusProxy
* aProxy
,
35 GVariant
* aParameters
,
37 static void DBusConnectClientResponse(GObject
* aObject
, GAsyncResult
* aResult
,
40 bool LaunchApp(const char* aCommand
, const char** aURIList
, int aURIListLen
);
42 void HandleFreedesktopActivate(GVariant
* aParameters
,
43 GDBusMethodInvocation
* aReply
);
44 void HandleFreedesktopOpen(GVariant
* aParameters
,
45 GDBusMethodInvocation
* aReply
);
46 void HandleFreedesktopActivateAction(GVariant
* aParameters
,
47 GDBusMethodInvocation
* aReply
);
49 bool StartFreedesktopListener();
50 void StopFreedesktopListener();
52 void OnBusAcquired(GDBusConnection
* aConnection
);
53 void OnNameAcquired(GDBusConnection
* aConnection
);
54 void OnNameLost(GDBusConnection
* aConnection
);
57 // The connection is owned by DBus library
59 uint mRegistrationId
= 0;
60 GDBusConnection
* mConnection
= nullptr;
61 RefPtr
<GDBusNodeInfo
> mIntrospectionData
;
62 const char* mAppFile
= nullptr;
65 } // namespace mozilla::widget
67 #endif // DBusService_h__