Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / toolkit / components / remote / nsGTKRemoteService.h
blob4b26d1e3d068e96ff63434531a25301b611de84f
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=2:tabstop=2:
3 */
4 /* ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
17 * The Original Code is mozilla.org code.
19 * The Initial Developer of the Original Code is
20 * Christopher Blizzard.
21 * Portions created by the Initial Developer are Copyright (C) 2001
22 * the Initial Developer. All Rights Reserved.
24 * Contributor(s):
25 * Christopher Blizzard <blizzard@mozilla.org>
26 * Benjamin Smedberg <benjamin@smedbergs.us>
28 * Alternatively, the contents of this file may be used under the terms of
29 * either the GNU General Public License Version 2 or later (the "GPL"), or
30 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
40 * ***** END LICENSE BLOCK ***** */
42 #ifndef __nsGTKRemoteService_h__
43 #define __nsGTKRemoteService_h__
45 #include "nsIRemoteService.h"
47 #include "nsIObserver.h"
49 #include <gdk/gdk.h>
50 #include <gdk/gdkx.h>
51 #include <gtk/gtk.h>
53 #include "nsString.h"
54 #include "nsInterfaceHashtable.h"
56 class nsIDOMWindow;
57 class nsIWeakReference;
58 class nsIWidget;
60 class nsGTKRemoteService : public nsIRemoteService,
61 public nsIObserver
63 public:
64 // We will be a static singleton, so don't use the ordinary methods.
65 NS_DECL_ISUPPORTS
66 NS_DECL_NSIREMOTESERVICE
67 NS_DECL_NSIOBSERVER
69 nsGTKRemoteService() :
70 mServerWindow(NULL) { }
72 private:
73 ~nsGTKRemoteService() { }
75 void HandleCommandsFor(GtkWidget* aWidget,
76 nsIWeakReference* aWindow);
78 static void EnsureAtoms();
79 static PLDHashOperator StartupHandler(const void* aKey,
80 nsIWeakReference* aData,
81 void* aClosure);
83 static const char* HandleCommand(char* aCommand, nsIDOMWindow* aWindow,
84 PRUint32 aTimestamp);
86 static const char* HandleCommandLine(char* aBuffer, nsIDOMWindow* aWindow,
87 PRUint32 aTimestamp);
89 static gboolean HandlePropertyChange(GtkWidget *widget,
90 GdkEventProperty *event,
91 nsIWeakReference* aThis);
93 GtkWidget* mServerWindow;
94 nsCString mAppName;
95 nsCString mProfileName;
96 nsInterfaceHashtable<nsVoidPtrHashKey, nsIWeakReference> mWindows;
98 static Atom sMozVersionAtom;
99 static Atom sMozLockAtom;
100 static Atom sMozCommandAtom;
101 static Atom sMozResponseAtom;
102 static Atom sMozUserAtom;
103 static Atom sMozProfileAtom;
104 static Atom sMozProgramAtom;
105 static Atom sMozCommandLineAtom;
108 #endif // __nsGTKRemoteService_h__