1 | /** @file
|
---|
2 | *
|
---|
3 | * XPCOM module implementation functions
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2009 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | /* Make sure all the stdint.h macros are included - must come first! */
|
---|
19 | #ifndef __STDC_LIMIT_MACROS
|
---|
20 | # define __STDC_LIMIT_MACROS
|
---|
21 | #endif
|
---|
22 | #ifndef __STDC_CONSTANT_MACROS
|
---|
23 | # define __STDC_CONSTANT_MACROS
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | #include <nsIGenericFactory.h>
|
---|
27 |
|
---|
28 | // generated file
|
---|
29 | #include "VirtualBox_XPCOM.h"
|
---|
30 |
|
---|
31 | #include "AdditionsFacilityImpl.h"
|
---|
32 | #include "ConsoleImpl.h"
|
---|
33 | #include "ConsoleVRDPServer.h"
|
---|
34 | #include "DisplayImpl.h"
|
---|
35 | #ifdef VBOX_WITH_EXTPACK
|
---|
36 | # include "ExtPackManagerImpl.h"
|
---|
37 | #endif
|
---|
38 | #include "GuestImpl.h"
|
---|
39 | #include "GuestDirectoryImpl.h"
|
---|
40 | #include "GuestDirEntryImpl.h"
|
---|
41 | #include "GuestFileImpl.h"
|
---|
42 | #include "GuestFsObjImpl.h"
|
---|
43 | #include "GuestSessionImpl.h"
|
---|
44 | #include "KeyboardImpl.h"
|
---|
45 | #include "MachineDebuggerImpl.h"
|
---|
46 | #include "MouseImpl.h"
|
---|
47 | #include "NATEngineImpl.h"
|
---|
48 | #include "NetworkAdapterImpl.h"
|
---|
49 | #include "ProgressCombinedImpl.h"
|
---|
50 | #include "ProgressImpl.h"
|
---|
51 | #include "RemoteUSBDeviceImpl.h"
|
---|
52 | #include "SessionImpl.h"
|
---|
53 | #include "SharedFolderImpl.h"
|
---|
54 | #include "USBDeviceImpl.h"
|
---|
55 | #include "VirtualBoxClientImpl.h"
|
---|
56 |
|
---|
57 | #include "Logging.h"
|
---|
58 |
|
---|
59 | // XPCOM glue code unfolding
|
---|
60 |
|
---|
61 | NS_DECL_CLASSINFO(Guest)
|
---|
62 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Guest, IGuest)
|
---|
63 | NS_DECL_CLASSINFO(GuestDirectory)
|
---|
64 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestDirectory, IGuestDirectory)
|
---|
65 | NS_DECL_CLASSINFO(GuestDirEntry)
|
---|
66 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestDirEntry, IGuestDirEntry)
|
---|
67 | NS_DECL_CLASSINFO(GuestFile)
|
---|
68 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestFile, IGuestFile)
|
---|
69 | NS_DECL_CLASSINFO(GuestFsObjInfo)
|
---|
70 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestFsObjInfo, IGuestFsObjInfo)
|
---|
71 | NS_DECL_CLASSINFO(GuestSession)
|
---|
72 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestSession, IGuestSession)
|
---|
73 | NS_DECL_CLASSINFO(Keyboard)
|
---|
74 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Keyboard, IKeyboard)
|
---|
75 | NS_DECL_CLASSINFO(Mouse)
|
---|
76 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Mouse, IMouse)
|
---|
77 | NS_DECL_CLASSINFO(Display)
|
---|
78 | NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Display, IDisplay, IEventListener)
|
---|
79 | NS_DECL_CLASSINFO(MachineDebugger)
|
---|
80 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MachineDebugger, IMachineDebugger)
|
---|
81 | NS_DECL_CLASSINFO(Progress)
|
---|
82 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Progress, IProgress)
|
---|
83 | NS_DECL_CLASSINFO(CombinedProgress)
|
---|
84 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(CombinedProgress, IProgress)
|
---|
85 | NS_DECL_CLASSINFO(OUSBDevice)
|
---|
86 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(OUSBDevice, IUSBDevice)
|
---|
87 | NS_DECL_CLASSINFO(RemoteUSBDevice)
|
---|
88 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(RemoteUSBDevice, IHostUSBDevice)
|
---|
89 | NS_DECL_CLASSINFO(SharedFolder)
|
---|
90 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder)
|
---|
91 | NS_DECL_CLASSINFO(VRDEServerInfo)
|
---|
92 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServerInfo, IVRDEServerInfo)
|
---|
93 | #ifdef VBOX_WITH_EXTPACK
|
---|
94 | NS_DECL_CLASSINFO(ExtPackFile)
|
---|
95 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackFile, IExtPackFile)
|
---|
96 | NS_DECL_CLASSINFO(ExtPack)
|
---|
97 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPack, IExtPack)
|
---|
98 | NS_DECL_CLASSINFO(ExtPackManager)
|
---|
99 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackManager, IExtPackManager)
|
---|
100 | #endif
|
---|
101 | NS_DECL_CLASSINFO(AdditionsFacility)
|
---|
102 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(AdditionsFacility, IAdditionsFacility)
|
---|
103 |
|
---|
104 | NS_DECL_CLASSINFO(Session)
|
---|
105 | NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Session, ISession, IInternalSessionControl)
|
---|
106 | NS_DECL_CLASSINFO(Console)
|
---|
107 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole)
|
---|
108 |
|
---|
109 | NS_DECL_CLASSINFO(VirtualBoxClient)
|
---|
110 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBoxClient, IVirtualBoxClient)
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Singleton class factory that holds a reference to the created instance
|
---|
114 | * (preventing it from being destroyed) until the module is explicitly
|
---|
115 | * unloaded by the XPCOM shutdown code.
|
---|
116 | *
|
---|
117 | * Suitable for IN-PROC components.
|
---|
118 | */
|
---|
119 | class SessionClassFactory : public Session
|
---|
120 | {
|
---|
121 | public:
|
---|
122 | virtual ~SessionClassFactory() {
|
---|
123 | FinalRelease();
|
---|
124 | instance = 0;
|
---|
125 | }
|
---|
126 | static nsresult getInstance (Session **inst) {
|
---|
127 | int rv = NS_OK;
|
---|
128 | if (instance == 0) {
|
---|
129 | instance = new SessionClassFactory();
|
---|
130 | if (instance) {
|
---|
131 | instance->AddRef(); // protect FinalConstruct()
|
---|
132 | rv = instance->FinalConstruct();
|
---|
133 | if (NS_FAILED(rv))
|
---|
134 | instance->Release();
|
---|
135 | else
|
---|
136 | instance->AddRef(); // self-reference
|
---|
137 | } else {
|
---|
138 | rv = NS_ERROR_OUT_OF_MEMORY;
|
---|
139 | }
|
---|
140 | } else {
|
---|
141 | instance->AddRef();
|
---|
142 | }
|
---|
143 | *inst = instance;
|
---|
144 | return rv;
|
---|
145 | }
|
---|
146 | static nsresult releaseInstance () {
|
---|
147 | if (instance)
|
---|
148 | instance->Release();
|
---|
149 | return NS_OK;
|
---|
150 | }
|
---|
151 |
|
---|
152 | private:
|
---|
153 | static Session *instance;
|
---|
154 | };
|
---|
155 |
|
---|
156 | /** @note this is for singleton; disabled for now */
|
---|
157 | //
|
---|
158 | //Session *SessionClassFactory::instance = 0;
|
---|
159 | //
|
---|
160 | //NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR_WITH_RC (
|
---|
161 | // Session, SessionClassFactory::getInstance
|
---|
162 | //)
|
---|
163 |
|
---|
164 | NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(Session)
|
---|
165 |
|
---|
166 | NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(VirtualBoxClient)
|
---|
167 |
|
---|
168 | /**
|
---|
169 | * Component definition table.
|
---|
170 | * Lists all components defined in this module.
|
---|
171 | */
|
---|
172 | static const nsModuleComponentInfo components[] =
|
---|
173 | {
|
---|
174 | {
|
---|
175 | "Session component", // description
|
---|
176 | NS_SESSION_CID, NS_SESSION_CONTRACTID, // CID/ContractID
|
---|
177 | SessionConstructor, // constructor function
|
---|
178 | NULL, // registration function
|
---|
179 | NULL, // deregistration function
|
---|
180 | /** @note this is for singleton; disabled for now */
|
---|
181 | // SessionClassFactory::releaseInstance,
|
---|
182 | NULL, // destructor function
|
---|
183 | NS_CI_INTERFACE_GETTER_NAME(Session), // interfaces function
|
---|
184 | NULL, // language helper
|
---|
185 | &NS_CLASSINFO_NAME(Session) // global class info & flags
|
---|
186 | },
|
---|
187 | {
|
---|
188 | "VirtualBoxClient component", // description
|
---|
189 | NS_VIRTUALBOXCLIENT_CID, NS_VIRTUALBOXCLIENT_CONTRACTID, // CID/ContractID
|
---|
190 | VirtualBoxClientConstructor, // constructor function
|
---|
191 | NULL, // registration function
|
---|
192 | NULL, // deregistration function
|
---|
193 | NULL, // destructor function
|
---|
194 | NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClient), // interfaces function
|
---|
195 | NULL, // language helper
|
---|
196 | &NS_CLASSINFO_NAME(VirtualBoxClient) // global class info & flags
|
---|
197 | },
|
---|
198 | };
|
---|
199 |
|
---|
200 | NS_IMPL_NSGETMODULE (VirtualBox_Client_Module, components)
|
---|
201 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|