VirtualBox

source: vbox/trunk/src/VBox/Main/include/ProgressProxyImpl.h@ 33060

Last change on this file since 33060 was 30739, checked in by vboxsync, 14 years ago

Main: remove VirtualBoxSupportTranslation template, add translation support to generic base class, clean up COM headers more, remove SupportErrorInfo.cpp|h

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/* $Id: ProgressProxyImpl.h 30739 2010-07-08 12:27:42Z vboxsync $ */
2/** @file
3 * IProgress implementation for Machine::openRemoteSession in VBoxSVC.
4 */
5
6/*
7 * Copyright (C) 2006-2010 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#ifndef ____H_PROGRESSPROXYIMPL
19#define ____H_PROGRESSPROXYIMPL
20
21#include "ProgressImpl.h"
22#include "AutoCaller.h"
23
24
25/**
26 * The ProgressProxy class allows proxying the important Progress calls and
27 * attributes to a different IProgress object for a period of time.
28 */
29class ATL_NO_VTABLE ProgressProxy :
30 //public com::SupportErrorInfoDerived<Progress, ProgressProxy, IProgress>,
31 public Progress
32{
33public:
34 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ProgressProxy, IProgress)
35
36 DECLARE_NOT_AGGREGATABLE(ProgressProxy)
37 DECLARE_PROTECT_FINAL_CONSTRUCT()
38
39 BEGIN_COM_MAP(ProgressProxy)
40 COM_INTERFACE_ENTRY (ISupportErrorInfo)
41 COM_INTERFACE_ENTRY (IProgress)
42 COM_INTERFACE_ENTRY2(IDispatch, IProgress)
43 END_COM_MAP()
44
45 HRESULT FinalConstruct();
46 void FinalRelease();
47 HRESULT init(
48#if !defined (VBOX_COM_INPROC)
49 VirtualBox *pParent,
50#endif
51 IUnknown *pInitiator,
52 CBSTR bstrDescription,
53 BOOL fCancelable);
54 HRESULT init(
55#if !defined (VBOX_COM_INPROC)
56 VirtualBox *pParent,
57#endif
58 IUnknown *pInitiator,
59 CBSTR bstrDescription,
60 BOOL fCancelable,
61 ULONG uTotalOperationsWeight,
62 CBSTR bstrFirstOperationDescription,
63 ULONG uFirstOperationWeight,
64 ULONG cOtherProgressObjectOperations);
65 void uninit();
66
67 // IProgress properties
68 STDMETHOD(COMGETTER(Cancelable))(BOOL *aCancelable);
69 STDMETHOD(COMGETTER(Percent))(ULONG *aPercent);
70 STDMETHOD(COMGETTER(TimeRemaining))(LONG *aTimeRemaining);
71 STDMETHOD(COMGETTER(Completed))(BOOL *aCompleted);
72 STDMETHOD(COMGETTER(Canceled))(BOOL *aCanceled);
73 STDMETHOD(COMGETTER(ResultCode))(LONG *aResultCode);
74 STDMETHOD(COMGETTER(ErrorInfo))(IVirtualBoxErrorInfo **aErrorInfo);
75 //STDMETHOD(COMGETTER(OperationCount))(ULONG *aOperationCount); - not necessary
76 STDMETHOD(COMGETTER(Operation))(ULONG *aOperation);
77 STDMETHOD(COMGETTER(OperationDescription))(BSTR *aOperationDescription);
78 STDMETHOD(COMGETTER(OperationPercent))(ULONG *aOperationPercent);
79 STDMETHOD(COMSETTER(Timeout))(ULONG aTimeout);
80 STDMETHOD(COMGETTER(Timeout))(ULONG *aTimeout);
81
82 // IProgress methods
83 STDMETHOD(WaitForCompletion)(LONG aTimeout);
84 STDMETHOD(WaitForOperationCompletion)(ULONG aOperation, LONG aTimeout);
85 STDMETHOD(Cancel)();
86 STDMETHOD(SetCurrentOperationProgress)(ULONG aPercent);
87 STDMETHOD(SetNextOperation)(IN_BSTR bstrNextOperationDescription, ULONG ulNextOperationsWeight);
88
89 // public methods only for internal purposes
90
91 HRESULT notifyComplete(HRESULT aResultCode);
92 HRESULT notifyComplete(HRESULT aResultCode,
93 const GUID &aIID,
94 const char *pcszComponent,
95 const char *aText, ...);
96 bool setOtherProgressObject(IProgress *pOtherProgress);
97
98 /** For com::SupportErrorInfoImpl. */
99 static const char *ComponentName() { return "ProgressProxy"; }
100
101protected:
102 void clearOtherProgressObjectInternal(bool fEarly);
103 void copyProgressInfo(IProgress *pOtherProgress, bool fEarly);
104
105private:
106 /** The other progress object. This can be NULL. */
107 ComPtr<IProgress> mptrOtherProgress;
108 /** Set if the other progress object has multiple operations. */
109 bool mfMultiOperation;
110 /** The weight the other progress object started at. */
111 ULONG muOtherProgressStartWeight;
112 /** The weight of other progress object. */
113 ULONG muOtherProgressWeight;
114 /** The operation number the other progress object started at. */
115 ULONG muOtherProgressStartOperation;
116
117};
118
119#endif /* !____H_PROGRESSPROXYIMPL */
120
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