1 /* -*- Mode: C++; tab-width: 8; 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/. */
5 
6 #ifndef DBusRemoteClient_h__
7 #define DBusRemoteClient_h__
8 
9 #include "nsRemoteClient.h"
10 #include "mozilla/StaticPtr.h"
11 #include "mozilla/DBusHelpers.h"
12 #include "nsString.h"
13 
14 class nsDBusRemoteClient : public nsRemoteClient {
15  public:
16   nsDBusRemoteClient();
17   ~nsDBusRemoteClient();
18 
19   virtual nsresult Init() override;
20   virtual nsresult SendCommandLine(const char* aProgram, const char* aProfile,
21                                    int32_t argc, char** argv,
22                                    const char* aDesktopStartupID,
23                                    char** aResponse, bool* aSucceeded) override;
24   void Shutdown();
25 
26  private:
27   bool GetRemoteDestinationName(const char* aProgram, const char* aProfile,
28                                 nsCString& aDestinationName);
29   nsresult DoSendDBusCommandLine(const char* aProgram, const char* aProfile,
30                                  const char* aBuffer, int aLength);
31   RefPtr<DBusConnection> mConnection;
32 };
33 
34 #endif  // DBusRemoteClient_h__
35