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
37 lines
1.1 KiB
C++
37 lines
1.1 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 DBusRemoteClient_h_
|
|
#define DBusRemoteClient_h_
|
|
|
|
#ifdef MOZ_ENABLE_DBUS
|
|
# include <gio/gio.h>
|
|
# include "mozilla/GRefPtr.h"
|
|
#endif
|
|
#include "nsRemoteClient.h"
|
|
#include "nsString.h"
|
|
#include "nscore.h"
|
|
|
|
class nsDBusRemoteClient : public nsRemoteClient {
|
|
public:
|
|
explicit nsDBusRemoteClient(nsACString& aStartupToken);
|
|
~nsDBusRemoteClient();
|
|
|
|
nsresult Init() override { return NS_OK; };
|
|
nsresult SendCommandLine(const char* aProgram, const char* aProfile,
|
|
int32_t argc, const char** argv,
|
|
bool aRaise) override;
|
|
void Shutdown();
|
|
|
|
private:
|
|
bool GetRemoteDestinationName(const char* aProgram, const char* aProfile,
|
|
nsCString& aDestinationName);
|
|
nsresult DoSendDBusCommandLine(const char* aProfile, const char* aBuffer,
|
|
int aLength);
|
|
|
|
nsACString& mStartupToken;
|
|
};
|
|
|
|
#endif // DBusRemoteClient_h_
|