VirtualBox

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

Last change on this file since 29927 was 29518, checked in by vboxsync, 15 years ago

Main: onMousePointerShapeChange reworked

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