I suspect these were left over from a previous libdbus(-glib?)
implementation.
Additionally, this moves away from using libdbus via dlsym to using
GLib/GIO directly for two functions:
dbus_validate_bus_name -> g_dbus_is_name
dbus_validate_path -> g_variant_is_object_path
(...odd name, I guess you have to put it somewhere?)
Had to keep the <dbus/dbus.h> include unfortunately for the
DBUS_MAXIMUM_NAME_LENGTH define. It should always be 255, so I guess we
could define it somewhere, but this was slightly easier. The whole
truncation thing seems really sketchy too, it was added in bug 1418770
but I'd rather not touch it right now.
Differential Revision: https://phabricator.services.mozilla.com/D305983
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef _nsDBusRemoteServer_h_
|
|
#define _nsDBusRemoteServer_h_
|
|
|
|
#include "nsRemoteServer.h"
|
|
#include "nsUnixRemoteServer.h"
|
|
#include "mozilla/Span.h"
|
|
|
|
#include <gio/gio.h>
|
|
#include "mozilla/RefPtr.h"
|
|
#include "mozilla/GRefPtr.h"
|
|
|
|
class nsDBusRemoteServer final : public nsRemoteServer,
|
|
public nsUnixRemoteServer {
|
|
public:
|
|
~nsDBusRemoteServer() override { Shutdown(); }
|
|
|
|
nsresult Startup(const char* aAppName, const char* aProfileName) override;
|
|
void Shutdown() override;
|
|
|
|
void OnBusAcquired(GDBusConnection* aConnection);
|
|
void OnNameAcquired(GDBusConnection* aConnection);
|
|
void OnNameLost(GDBusConnection* aConnection);
|
|
|
|
bool HandleOpenURL(const gchar* aInterfaceName, const gchar* aMethodName,
|
|
mozilla::Span<const gchar> aParam);
|
|
|
|
private:
|
|
uint mDBusID = 0;
|
|
uint mRegistrationId = 0;
|
|
GDBusConnection* mConnection = nullptr;
|
|
RefPtr<GDBusNodeInfo> mIntrospectionData;
|
|
|
|
nsCString mAppName;
|
|
nsCString mPathName;
|
|
};
|
|
|
|
#endif // _nsDBusRemoteServer_h_
|