VirtualBox

source: vbox/trunk/src/VBox/Main/src-client/xpcom/module.cpp@ 47981

Last change on this file since 47981 was 46824, checked in by vboxsync, 12 years ago

Main: forgotten file for previous fix

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.6 KB
Line 
1/** @file
2 *
3 * XPCOM module implementation functions
4 */
5
6/*
7 * Copyright (C) 2006-2012 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#ifdef VBOX_WITH_GUEST_CONTROL
40# include "GuestDirectoryImpl.h"
41# include "GuestFileImpl.h"
42# include "GuestFsObjInfoImpl.h"
43# include "GuestProcessImpl.h"
44# include "GuestSessionImpl.h"
45#endif
46#include "KeyboardImpl.h"
47#include "MachineDebuggerImpl.h"
48#include "MouseImpl.h"
49#include "NATEngineImpl.h"
50#include "NetworkAdapterImpl.h"
51#include "ProgressImpl.h"
52#include "RemoteUSBDeviceImpl.h"
53#include "SessionImpl.h"
54#include "SharedFolderImpl.h"
55#include "USBDeviceImpl.h"
56#include "VirtualBoxClientImpl.h"
57
58#include "Logging.h"
59
60// XPCOM glue code unfolding
61
62NS_DECL_CLASSINFO(Guest)
63NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Guest, IGuest)
64#ifdef VBOX_WITH_GUEST_CONTROL
65NS_DECL_CLASSINFO(GuestDirectory)
66NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestDirectory, IGuestDirectory, IDirectory)
67NS_DECL_CLASSINFO(GuestFile)
68NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestFile, IGuestFile, IFile)
69NS_DECL_CLASSINFO(GuestFsObjInfo)
70NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestFsObjInfo, IGuestFsObjInfo, IFsObjInfo)
71NS_DECL_CLASSINFO(GuestProcess)
72NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestProcess, IGuestProcess, IProcess)
73NS_DECL_CLASSINFO(GuestSession)
74NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestSession, IGuestSession)
75#endif
76NS_DECL_CLASSINFO(Keyboard)
77NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Keyboard, IKeyboard)
78NS_DECL_CLASSINFO(Mouse)
79NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Mouse, IMouse)
80NS_DECL_CLASSINFO(Display)
81NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Display, IDisplay, IEventListener)
82NS_DECL_CLASSINFO(MachineDebugger)
83NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MachineDebugger, IMachineDebugger)
84NS_DECL_CLASSINFO(Progress)
85NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Progress, IProgress)
86NS_DECL_CLASSINFO(OUSBDevice)
87NS_IMPL_THREADSAFE_ISUPPORTS1_CI(OUSBDevice, IUSBDevice)
88NS_DECL_CLASSINFO(RemoteUSBDevice)
89NS_IMPL_THREADSAFE_ISUPPORTS2_CI(RemoteUSBDevice, IHostUSBDevice, IUSBDevice)
90NS_DECL_CLASSINFO(SharedFolder)
91NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder)
92NS_DECL_CLASSINFO(VRDEServerInfo)
93NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServerInfo, IVRDEServerInfo)
94#ifdef VBOX_WITH_EXTPACK
95// deliberately omit ExtPackFile as it's unusable in the client context
96// NS_DECL_CLASSINFO(ExtPackFile)
97// NS_IMPL_THREADSAFE_ISUPPORTS2_CI(ExtPackFile, IExtPackFile, IExtPackBase)
98NS_DECL_CLASSINFO(ExtPack)
99NS_IMPL_THREADSAFE_ISUPPORTS2_CI(ExtPack, IExtPack, IExtPackBase)
100NS_DECL_CLASSINFO(ExtPackManager)
101NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackManager, IExtPackManager)
102#endif
103NS_DECL_CLASSINFO(AdditionsFacility)
104NS_IMPL_THREADSAFE_ISUPPORTS1_CI(AdditionsFacility, IAdditionsFacility)
105
106NS_DECL_CLASSINFO(Session)
107NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Session, ISession, IInternalSessionControl)
108NS_DECL_CLASSINFO(Console)
109NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole)
110
111NS_DECL_CLASSINFO(VirtualBoxClient)
112NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBoxClient, IVirtualBoxClient)
113
114/**
115 * Singleton class factory that holds a reference to the created instance
116 * (preventing it from being destroyed) until the module is explicitly
117 * unloaded by the XPCOM shutdown code.
118 *
119 * Suitable for IN-PROC components.
120 */
121class SessionClassFactory : public Session
122{
123public:
124 virtual ~SessionClassFactory() {
125 FinalRelease();
126 instance = 0;
127 }
128 static nsresult getInstance (Session **inst) {
129 int rv = NS_OK;
130 if (instance == 0) {
131 instance = new SessionClassFactory();
132 if (instance) {
133 instance->AddRef(); // protect FinalConstruct()
134 rv = instance->FinalConstruct();
135 if (NS_FAILED(rv))
136 instance->Release();
137 else
138 instance->AddRef(); // self-reference
139 } else {
140 rv = NS_ERROR_OUT_OF_MEMORY;
141 }
142 } else {
143 instance->AddRef();
144 }
145 *inst = instance;
146 return rv;
147 }
148 static nsresult releaseInstance () {
149 if (instance)
150 instance->Release();
151 return NS_OK;
152 }
153
154private:
155 static Session *instance;
156};
157
158/** @note this is for singleton; disabled for now */
159//
160//Session *SessionClassFactory::instance = 0;
161//
162//NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR_WITH_RC (
163// Session, SessionClassFactory::getInstance
164//)
165
166NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(Session)
167
168NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(VirtualBoxClient)
169
170/**
171 * Component definition table.
172 * Lists all components defined in this module.
173 */
174static const nsModuleComponentInfo components[] =
175{
176 {
177 "Session component", // description
178 NS_SESSION_CID, NS_SESSION_CONTRACTID, // CID/ContractID
179 SessionConstructor, // constructor function
180 NULL, // registration function
181 NULL, // deregistration function
182/** @note this is for singleton; disabled for now */
183// SessionClassFactory::releaseInstance,
184 NULL, // destructor function
185 NS_CI_INTERFACE_GETTER_NAME(Session), // interfaces function
186 NULL, // language helper
187 &NS_CLASSINFO_NAME(Session) // global class info & flags
188 },
189 {
190 "VirtualBoxClient component", // description
191 NS_VIRTUALBOXCLIENT_CID, NS_VIRTUALBOXCLIENT_CONTRACTID, // CID/ContractID
192 VirtualBoxClientConstructor, // constructor function
193 NULL, // registration function
194 NULL, // deregistration function
195 NULL, // destructor function
196 NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClient), // interfaces function
197 NULL, // language helper
198 &NS_CLASSINFO_NAME(VirtualBoxClient) // global class info & flags
199 },
200};
201
202NS_IMPL_NSGETMODULE (VirtualBox_Client_Module, components)
203/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette