VirtualBox

source: vbox/trunk/src/VBox/Main/VirtualBoxCallbackImpl.cpp@ 30430

Last change on this file since 30430 was 30381, checked in by vboxsync, 14 years ago

Main: generic events (disabled)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 KB
Line 
1/** @file
2 *
3 * VBox Client callback COM Class implementation
4 */
5
6/*
7 * Copyright (C) 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#include "VirtualBoxCallbackImpl.h"
19#include "Logging.h"
20#include "AutoCaller.h"
21
22HRESULT CallbackWrapper::FinalConstruct()
23{
24 return S_OK;
25}
26
27void CallbackWrapper::FinalRelease()
28{
29}
30
31// public initializers/uninitializers only for internal purposes
32HRESULT CallbackWrapper::init()
33{
34 AutoInitSpan autoInitSpan(this);
35 AssertReturn(autoInitSpan.isOk(), E_FAIL);
36 /* Confirm a successful initialization */
37 autoInitSpan.setSucceeded();
38 return S_OK;
39}
40
41void CallbackWrapper::uninit(bool aFinalRelease)
42{
43}
44
45// ILocalOwner methods
46/////////////////////////////////////////////////////////////////////////////
47
48STDMETHODIMP CallbackWrapper::SetLocalObject(IUnknown *aCallback)
49{
50 if (aCallback == NULL)
51 {
52 mVBoxCallback.setNull();
53 mConsoleCallback.setNull();
54 return S_OK;
55 }
56
57 if (!VALID_PTR (aCallback))
58 return E_POINTER;
59
60 mVBoxCallback = aCallback;
61 mConsoleCallback = aCallback;
62
63 // or some other error code?
64 AssertReturn(!!mVBoxCallback || !!mConsoleCallback, E_FAIL);
65
66 return S_OK;
67}
68
69// IVirtualBoxCallback methods
70/////////////////////////////////////////////////////////////////////////////
71STDMETHODIMP CallbackWrapper::OnMachineStateChange(IN_BSTR machineId, MachineState_T state)
72{
73 if (mVBoxCallback.isNull())
74 return S_OK;
75
76 return mVBoxCallback->OnMachineStateChange(machineId, state);
77}
78
79STDMETHODIMP CallbackWrapper::OnMachineDataChange(IN_BSTR machineId)
80{
81 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
82
83 if (mVBoxCallback.isNull())
84 return S_OK;
85
86 return mVBoxCallback->OnMachineDataChange(machineId);
87}
88
89
90STDMETHODIMP CallbackWrapper::OnExtraDataCanChange(IN_BSTR machineId, IN_BSTR key, IN_BSTR value,
91 BSTR *error, BOOL *changeAllowed)
92{
93 if (mVBoxCallback.isNull())
94 return S_OK;
95
96 return mVBoxCallback->OnExtraDataCanChange(machineId, key, value, error, changeAllowed);
97}
98
99STDMETHODIMP CallbackWrapper::OnExtraDataChange(IN_BSTR machineId, IN_BSTR key, IN_BSTR value)
100{
101 if (mVBoxCallback.isNull())
102 return S_OK;
103
104 return mVBoxCallback->OnExtraDataChange(machineId, key, value);
105}
106
107STDMETHODIMP CallbackWrapper::OnMediumRegistered(IN_BSTR mediaId, DeviceType_T mediaType,
108 BOOL registered)
109{
110 if (mVBoxCallback.isNull())
111 return S_OK;
112
113 return mVBoxCallback->OnMediumRegistered(mediaId, mediaType, registered);
114}
115
116
117STDMETHODIMP CallbackWrapper::OnMachineRegistered(IN_BSTR aMachineId, BOOL registered)
118{
119 if (mVBoxCallback.isNull())
120 return S_OK;
121
122 return mVBoxCallback->OnMachineRegistered(aMachineId, registered);
123}
124
125STDMETHODIMP CallbackWrapper::OnSessionStateChange(IN_BSTR aMachineId, SessionState_T state)
126{
127 if (mVBoxCallback.isNull())
128 return S_OK;
129
130 return mVBoxCallback->OnSessionStateChange(aMachineId, state);
131}
132
133STDMETHODIMP CallbackWrapper::OnSnapshotTaken(IN_BSTR aMachineId, IN_BSTR aSnapshotId)
134{
135 if (mVBoxCallback.isNull())
136 return S_OK;
137
138 return mVBoxCallback->OnSnapshotTaken(aMachineId, aSnapshotId);
139}
140
141STDMETHODIMP CallbackWrapper::OnSnapshotDeleted(IN_BSTR aMachineId, IN_BSTR aSnapshotId)
142{
143 if (mVBoxCallback.isNull())
144 return S_OK;
145
146 return mVBoxCallback->OnSnapshotDeleted(aMachineId, aSnapshotId);
147}
148
149STDMETHODIMP CallbackWrapper::OnSnapshotChange(IN_BSTR aMachineId, IN_BSTR aSnapshotId)
150{
151 if (mVBoxCallback.isNull())
152 return S_OK;
153
154 return mVBoxCallback->OnSnapshotChange(aMachineId, aSnapshotId);
155}
156
157STDMETHODIMP CallbackWrapper::OnGuestPropertyChange(IN_BSTR aMachineId, IN_BSTR key, IN_BSTR value, IN_BSTR flags)
158{
159 if (mVBoxCallback.isNull())
160 return S_OK;
161
162 return mVBoxCallback->OnGuestPropertyChange(aMachineId, key, value, flags);
163}
164
165
166// IConsoleCallback methods
167/////////////////////////////////////////////////////////////////////////////
168STDMETHODIMP CallbackWrapper::OnMousePointerShapeChange(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot,
169 ULONG width, ULONG height, ComSafeArrayIn(BYTE, shape))
170{
171 if (mConsoleCallback.isNull())
172 return S_OK;
173
174 return mConsoleCallback->OnMousePointerShapeChange(visible, alpha, xHot, yHot, width, height, ComSafeArrayInArg(shape));
175}
176
177
178STDMETHODIMP CallbackWrapper::OnMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor)
179{
180 if (mConsoleCallback.isNull())
181 return S_OK;
182
183 return mConsoleCallback->OnMouseCapabilityChange(supportsAbsolute, supportsRelative, needsHostCursor);
184}
185
186STDMETHODIMP CallbackWrapper::OnKeyboardLedsChange(BOOL fNumLock, BOOL fCapsLock, BOOL fScrollLock)
187{
188 if (mConsoleCallback.isNull())
189 return S_OK;
190
191 return mConsoleCallback->OnKeyboardLedsChange(fNumLock, fCapsLock, fScrollLock);
192}
193
194STDMETHODIMP CallbackWrapper::OnStateChange(MachineState_T machineState)
195{
196 if (mConsoleCallback.isNull())
197 return S_OK;
198
199 return mConsoleCallback->OnStateChange(machineState);
200}
201
202STDMETHODIMP CallbackWrapper::OnAdditionsStateChange()
203{
204 if (mConsoleCallback.isNull())
205 return S_OK;
206
207 return mConsoleCallback->OnAdditionsStateChange();
208}
209
210STDMETHODIMP CallbackWrapper::OnNetworkAdapterChange(INetworkAdapter *aNetworkAdapter)
211{
212 if (mConsoleCallback.isNull())
213 return S_OK;
214
215 return mConsoleCallback->OnNetworkAdapterChange(aNetworkAdapter);
216}
217
218STDMETHODIMP CallbackWrapper::OnSerialPortChange(ISerialPort *aSerialPort)
219{
220 if (mConsoleCallback.isNull())
221 return S_OK;
222
223 return mConsoleCallback->OnSerialPortChange(aSerialPort);
224}
225
226STDMETHODIMP CallbackWrapper::OnParallelPortChange(IParallelPort *aParallelPort)
227{
228 if (mConsoleCallback.isNull())
229 return S_OK;
230
231 return mConsoleCallback->OnParallelPortChange(aParallelPort);
232}
233
234STDMETHODIMP CallbackWrapper::OnRemoteDisplayInfoChange()
235{
236 if (mConsoleCallback.isNull())
237 return S_OK;
238
239 return mConsoleCallback->OnRemoteDisplayInfoChange();
240}
241
242STDMETHODIMP CallbackWrapper::OnVRDPServerChange()
243{
244 if (mConsoleCallback.isNull())
245 return S_OK;
246
247 return mConsoleCallback->OnVRDPServerChange();
248}
249
250STDMETHODIMP CallbackWrapper::OnUSBControllerChange()
251{
252 if (mConsoleCallback.isNull())
253 return S_OK;
254
255 return mConsoleCallback->OnUSBControllerChange();
256}
257
258STDMETHODIMP CallbackWrapper::OnUSBDeviceStateChange(IUSBDevice *aDevice,
259 BOOL aAttached,
260 IVirtualBoxErrorInfo *aError)
261{
262 if (mConsoleCallback.isNull())
263 return S_OK;
264
265 return mConsoleCallback->OnUSBDeviceStateChange(aDevice, aAttached, aError);
266}
267
268STDMETHODIMP CallbackWrapper::OnSharedFolderChange(Scope_T aScope)
269{
270 if (mConsoleCallback.isNull())
271 return S_OK;
272
273 return mConsoleCallback->OnSharedFolderChange(aScope);
274}
275
276STDMETHODIMP CallbackWrapper::OnStorageControllerChange()
277{
278 if (mConsoleCallback.isNull())
279 return S_OK;
280
281 return mConsoleCallback->OnStorageControllerChange();
282}
283
284STDMETHODIMP CallbackWrapper::OnMediumChange(IMediumAttachment *aMediumAttachment)
285{
286 if (mConsoleCallback.isNull())
287 return S_OK;
288
289 return mConsoleCallback->OnMediumChange(aMediumAttachment);
290}
291
292STDMETHODIMP CallbackWrapper::OnCPUChange(ULONG aCPU, BOOL aRemove)
293{
294 if (mConsoleCallback.isNull())
295 return S_OK;
296
297 return mConsoleCallback->OnCPUChange(aCPU, aRemove);
298}
299
300STDMETHODIMP CallbackWrapper::OnRuntimeError(BOOL fFatal, IN_BSTR id, IN_BSTR message)
301{
302 if (mConsoleCallback.isNull())
303 return S_OK;
304
305 return mConsoleCallback->OnRuntimeError(fFatal, id, message);
306}
307
308STDMETHODIMP CallbackWrapper::OnCanShowWindow(BOOL *canShow)
309{
310 if (mConsoleCallback.isNull())
311 return S_OK;
312
313 return mConsoleCallback->OnCanShowWindow(canShow);
314}
315
316STDMETHODIMP CallbackWrapper::OnShowWindow(ULONG64 *winId)
317{
318 if (mConsoleCallback.isNull())
319 return S_OK;
320
321 return mConsoleCallback->OnShowWindow(winId);
322}
323
Note: See TracBrowser for help on using the repository browser.

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