|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim:expandtab:shiftwidth=2:tabstop=8: |
|
3 */ |
|
4 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
7 |
|
8 #ifndef NSXREMOTESERVICE_H |
|
9 #define NSXREMOTESERVICE_H |
|
10 |
|
11 #include "nsString.h" |
|
12 |
|
13 #include "nsIRemoteService.h" |
|
14 #include "nsIObserver.h" |
|
15 #include <X11/Xlib.h> |
|
16 #include <X11/X.h> |
|
17 |
|
18 class nsIDOMWindow; |
|
19 class nsIWeakReference; |
|
20 |
|
21 /** |
|
22 Base class for GTK/Qt remote service |
|
23 */ |
|
24 class nsXRemoteService : public nsIRemoteService, |
|
25 public nsIObserver |
|
26 { |
|
27 public: |
|
28 NS_DECL_NSIOBSERVER |
|
29 |
|
30 |
|
31 protected: |
|
32 nsXRemoteService(); |
|
33 |
|
34 static bool HandleNewProperty(Window aWindowId,Display* aDisplay, |
|
35 Time aEventTime, Atom aChangedAtom, |
|
36 nsIWeakReference* aDomWindow); |
|
37 |
|
38 void XRemoteBaseStartup(const char *aAppName, const char *aProfileName); |
|
39 |
|
40 void HandleCommandsFor(Window aWindowId); |
|
41 static nsXRemoteService *sRemoteImplementation; |
|
42 private: |
|
43 void EnsureAtoms(); |
|
44 static const char* HandleCommand(char* aCommand, nsIDOMWindow* aWindow, |
|
45 uint32_t aTimestamp); |
|
46 |
|
47 static const char* HandleCommandLine(char* aBuffer, nsIDOMWindow* aWindow, |
|
48 uint32_t aTimestamp); |
|
49 |
|
50 virtual void SetDesktopStartupIDOrTimestamp(const nsACString& aDesktopStartupID, |
|
51 uint32_t aTimestamp) = 0; |
|
52 |
|
53 nsCString mAppName; |
|
54 nsCString mProfileName; |
|
55 |
|
56 static Atom sMozVersionAtom; |
|
57 static Atom sMozLockAtom; |
|
58 static Atom sMozCommandAtom; |
|
59 static Atom sMozResponseAtom; |
|
60 static Atom sMozUserAtom; |
|
61 static Atom sMozProfileAtom; |
|
62 static Atom sMozProgramAtom; |
|
63 static Atom sMozCommandLineAtom; |
|
64 }; |
|
65 |
|
66 #endif // NSXREMOTESERVICE_H |