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.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 |
|
---|
62 | NS_DECL_CLASSINFO(VirtualBoxClient)
|
---|
63 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBoxClient, IVirtualBoxClient)
|
---|
64 |
|
---|
65 | #ifndef VBOX_COM_INPROC_API_CLIENT
|
---|
66 | NS_DECL_CLASSINFO(Keyboard)
|
---|
67 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Keyboard, IKeyboard)
|
---|
68 | NS_DECL_CLASSINFO(RemoteUSBDevice)
|
---|
69 | NS_IMPL_THREADSAFE_ISUPPORTS2_CI(RemoteUSBDevice, IHostUSBDevice, IUSBDevice)
|
---|
70 | NS_DECL_CLASSINFO(VRDEServerInfo)
|
---|
71 | NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServerInfo, IVRDEServerInfo)
|
---|
72 | #ifdef VBOX_WITH_EXTPACK
|
---|
73 | // deliberately omit ExtPackFile as it's unusable in the client context
|
---|
74 | // NS_DECL_CLASSINFO(ExtPackFile)
|
---|
75 | // NS_IMPL_THREADSAFE_ISUPPORTS2_CI(ExtPackFile, IExtPackFile, IExtPackBase)
|
---|
76 | #endif
|
---|
77 |
|
---|
78 | #endif /* VBOX_COM_INPROC_API_CLIENT */
|
---|
79 |
|
---|
80 | /*
|
---|
81 | * Declare extern variables here to tell the compiler that
|
---|
82 | * NS_DECL_CLASSINFO(SessionWrap)
|
---|
83 | * already exists in the VBoxAPIWrap library.
|
---|
84 | */
|
---|
85 | NS_DECL_CI_INTERFACE_GETTER(SessionWrap)
|
---|
86 | extern nsIClassInfo *NS_CLASSINFO_NAME(SessionWrap);
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Singleton class factory that holds a reference to the created instance
|
---|
90 | * (preventing it from being destroyed) until the module is explicitly
|
---|
91 | * unloaded by the XPCOM shutdown code.
|
---|
92 | *
|
---|
93 | * Suitable for IN-PROC components.
|
---|
94 | */
|
---|
95 | class SessionClassFactory : public Session
|
---|
96 | {
|
---|
97 | public:
|
---|
98 | virtual ~SessionClassFactory() {
|
---|
99 | FinalRelease();
|
---|
100 | instance = 0;
|
---|
101 | }
|
---|
102 | static nsresult getInstance (Session **inst) {
|
---|
103 | int rv = NS_OK;
|
---|
104 | if (instance == 0) {
|
---|
105 | instance = new SessionClassFactory();
|
---|
106 | if (instance) {
|
---|
107 | instance->AddRef(); // protect FinalConstruct()
|
---|
108 | rv = instance->FinalConstruct();
|
---|
109 | if (NS_FAILED(rv))
|
---|
110 | instance->Release();
|
---|
111 | else
|
---|
112 | instance->AddRef(); // self-reference
|
---|
113 | } else {
|
---|
114 | rv = NS_ERROR_OUT_OF_MEMORY;
|
---|
115 | }
|
---|
116 | } else {
|
---|
117 | instance->AddRef();
|
---|
118 | }
|
---|
119 | *inst = instance;
|
---|
120 | return rv;
|
---|
121 | }
|
---|
122 | static nsresult releaseInstance () {
|
---|
123 | if (instance)
|
---|
124 | instance->Release();
|
---|
125 | return NS_OK;
|
---|
126 | }
|
---|
127 |
|
---|
128 | private:
|
---|
129 | static Session *instance;
|
---|
130 | };
|
---|
131 |
|
---|
132 | /** @note this is for singleton; disabled for now */
|
---|
133 | //
|
---|
134 | //Session *SessionClassFactory::instance = 0;
|
---|
135 | //
|
---|
136 | //NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR_WITH_RC (
|
---|
137 | // Session, SessionClassFactory::getInstance
|
---|
138 | //)
|
---|
139 |
|
---|
140 | NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(Session)
|
---|
141 |
|
---|
142 | NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(VirtualBoxClient)
|
---|
143 |
|
---|
144 | /**
|
---|
145 | * Component definition table.
|
---|
146 | * Lists all components defined in this module.
|
---|
147 | */
|
---|
148 | static const nsModuleComponentInfo components[] =
|
---|
149 | {
|
---|
150 | {
|
---|
151 | "Session component", // description
|
---|
152 | NS_SESSION_CID, NS_SESSION_CONTRACTID, // CID/ContractID
|
---|
153 | SessionConstructor, // constructor function
|
---|
154 | NULL, // registration function
|
---|
155 | NULL, // deregistration function
|
---|
156 | /** @note this is for singleton; disabled for now */
|
---|
157 | // SessionClassFactory::releaseInstance,
|
---|
158 | NULL, // destructor function
|
---|
159 | NS_CI_INTERFACE_GETTER_NAME(SessionWrap), // interfaces function
|
---|
160 | NULL, // language helper
|
---|
161 | &NS_CLASSINFO_NAME(SessionWrap) // global class info & flags
|
---|
162 | },
|
---|
163 | {
|
---|
164 | "VirtualBoxClient component", // description
|
---|
165 | NS_VIRTUALBOXCLIENT_CID, NS_VIRTUALBOXCLIENT_CONTRACTID, // CID/ContractID
|
---|
166 | VirtualBoxClientConstructor, // constructor function
|
---|
167 | NULL, // registration function
|
---|
168 | NULL, // deregistration function
|
---|
169 | NULL, // destructor function
|
---|
170 | NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClient), // interfaces function
|
---|
171 | NULL, // language helper
|
---|
172 | &NS_CLASSINFO_NAME(VirtualBoxClient) // global class info & flags
|
---|
173 | },
|
---|
174 | };
|
---|
175 |
|
---|
176 | NS_IMPL_NSGETMODULE (VirtualBox_Client_Module, components)
|
---|
177 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|