VirtualBox

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

Last change on this file since 50727 was 50727, checked in by vboxsync, 11 years ago

6813 src-client/GuestSessionImpl.cpp

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
Line 
1/** @file
2 *
3 * XPCOM module implementation functions
4 */
5
6/*
7 * Copyright (C) 2006-2014 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.215389.xyz. 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(VirtualBoxClient)
63NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBoxClient, IVirtualBoxClient)
64NS_DECL_CLASSINFO(Session)
65NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Session, ISession, IInternalSessionControl)
66
67#ifndef VBOX_COM_INPROC_API_CLIENT
68NS_DECL_CLASSINFO(Guest)
69NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Guest, IGuest)
70NS_DECL_CLASSINFO(Keyboard)
71NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Keyboard, IKeyboard)
72NS_DECL_CLASSINFO(Display)
73NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Display, IDisplay, IEventListener)
74NS_DECL_CLASSINFO(MachineDebugger)
75NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MachineDebugger, IMachineDebugger)
76NS_DECL_CLASSINFO(Progress)
77NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Progress, IProgress)
78NS_DECL_CLASSINFO(RemoteUSBDevice)
79NS_IMPL_THREADSAFE_ISUPPORTS2_CI(RemoteUSBDevice, IHostUSBDevice, IUSBDevice)
80NS_DECL_CLASSINFO(SharedFolder)
81NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder)
82NS_DECL_CLASSINFO(VRDEServerInfo)
83NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServerInfo, IVRDEServerInfo)
84 #ifdef VBOX_WITH_EXTPACK
85// deliberately omit ExtPackFile as it's unusable in the client context
86// NS_DECL_CLASSINFO(ExtPackFile)
87// NS_IMPL_THREADSAFE_ISUPPORTS2_CI(ExtPackFile, IExtPackFile, IExtPackBase)
88NS_DECL_CLASSINFO(ExtPack)
89NS_IMPL_THREADSAFE_ISUPPORTS2_CI(ExtPack, IExtPack, IExtPackBase)
90NS_DECL_CLASSINFO(ExtPackManager)
91NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackManager, IExtPackManager)
92 #endif
93
94NS_DECL_CLASSINFO(Console)
95NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole)
96
97#endif /* VBOX_COM_INPROC_API_CLIENT */
98
99/**
100 * Singleton class factory that holds a reference to the created instance
101 * (preventing it from being destroyed) until the module is explicitly
102 * unloaded by the XPCOM shutdown code.
103 *
104 * Suitable for IN-PROC components.
105 */
106class SessionClassFactory : public Session
107{
108public:
109 virtual ~SessionClassFactory() {
110 FinalRelease();
111 instance = 0;
112 }
113 static nsresult getInstance (Session **inst) {
114 int rv = NS_OK;
115 if (instance == 0) {
116 instance = new SessionClassFactory();
117 if (instance) {
118 instance->AddRef(); // protect FinalConstruct()
119 rv = instance->FinalConstruct();
120 if (NS_FAILED(rv))
121 instance->Release();
122 else
123 instance->AddRef(); // self-reference
124 } else {
125 rv = NS_ERROR_OUT_OF_MEMORY;
126 }
127 } else {
128 instance->AddRef();
129 }
130 *inst = instance;
131 return rv;
132 }
133 static nsresult releaseInstance () {
134 if (instance)
135 instance->Release();
136 return NS_OK;
137 }
138
139private:
140 static Session *instance;
141};
142
143/** @note this is for singleton; disabled for now */
144//
145//Session *SessionClassFactory::instance = 0;
146//
147//NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR_WITH_RC (
148// Session, SessionClassFactory::getInstance
149//)
150
151NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(Session)
152
153NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(VirtualBoxClient)
154
155/**
156 * Component definition table.
157 * Lists all components defined in this module.
158 */
159static const nsModuleComponentInfo components[] =
160{
161 {
162 "Session component", // description
163 NS_SESSION_CID, NS_SESSION_CONTRACTID, // CID/ContractID
164 SessionConstructor, // constructor function
165 NULL, // registration function
166 NULL, // deregistration function
167/** @note this is for singleton; disabled for now */
168// SessionClassFactory::releaseInstance,
169 NULL, // destructor function
170 NS_CI_INTERFACE_GETTER_NAME(Session), // interfaces function
171 NULL, // language helper
172 &NS_CLASSINFO_NAME(Session) // global class info & flags
173 },
174 {
175 "VirtualBoxClient component", // description
176 NS_VIRTUALBOXCLIENT_CID, NS_VIRTUALBOXCLIENT_CONTRACTID, // CID/ContractID
177 VirtualBoxClientConstructor, // constructor function
178 NULL, // registration function
179 NULL, // deregistration function
180 NULL, // destructor function
181 NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClient), // interfaces function
182 NULL, // language helper
183 &NS_CLASSINFO_NAME(VirtualBoxClient) // global class info & flags
184 },
185};
186
187NS_IMPL_NSGETMODULE (VirtualBox_Client_Module, components)
188/* 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