Changeset 34714 in vbox
- Timestamp:
- Dec 3, 2010 10:19:31 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 68517
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ExtPackManagerImpl.cpp
r34711 r34714 64 64 * Structures and Typedefs * 65 65 *******************************************************************************/ 66 /** 67 * Private extension pack data. 68 */ 69 struct ExtPack::Data 66 struct ExtPackBaseData 70 67 { 71 68 public: … … 79 76 /** Why it is unusable. */ 80 77 Utf8Str strWhyUnusable; 81 78 }; 79 80 /** 81 * Private extension pack data. 82 */ 83 struct ExtPackFile::Data : public ExtPackBaseData 84 { 85 public: 86 /** The path to the tarball. */ 87 Utf8Str strExtPackFile; 88 /** The file handle of the extension pack file. */ 89 RTFILE hExtPackFile; 90 }; 91 92 /** 93 * Private extension pack data. 94 */ 95 struct ExtPack::Data : public ExtPackBaseData 96 { 97 public: 82 98 /** Where the extension pack is located. */ 83 99 Utf8Str strExtPackPath; … … 128 144 VBOXEXTPACKCTX enmContext; 129 145 }; 146 147 148 DEFINE_EMPTY_CTOR_DTOR(ExtPackFile) 149 150 /** 151 * Called by ComObjPtr::createObject when creating the object. 152 * 153 * Just initialize the basic object state, do the rest in initWithDir(). 154 * 155 * @returns S_OK. 156 */ 157 HRESULT ExtPackFile::FinalConstruct() 158 { 159 m = NULL; 160 return S_OK; 161 } 162 163 /** 164 * Initializes the extension pack by reading its file. 165 * 166 * @returns COM status code. 167 * @param a_pszFile The path to the extension pack file. 168 */ 169 HRESULT ExtPackFile::initWithFile(const char *a_pszFile) 170 { 171 AutoInitSpan autoInitSpan(this); 172 AssertReturn(autoInitSpan.isOk(), E_FAIL); 173 174 /* 175 * Allocate + initialize our private data. 176 */ 177 m = new ExtPackFile::Data; 178 m->Desc.strName = NULL; 179 RT_ZERO(m->ObjInfoDesc); 180 m->fUsable = false; 181 m->strWhyUnusable = tr("ExtPack::init failed"); 182 m->strExtPackFile = a_pszFile; 183 184 /* 185 * Probe the extension pack (this code is shared with refresh()). 186 */ 187 188 autoInitSpan.setSucceeded(); 189 return S_OK; 190 } 191 192 /** 193 * COM cruft. 194 */ 195 void ExtPackFile::FinalRelease() 196 { 197 uninit(); 198 } 199 200 /** 201 * Do the actual cleanup. 202 */ 203 void ExtPackFile::uninit() 204 { 205 /* Enclose the state transition Ready->InUninit->NotReady */ 206 AutoUninitSpan autoUninitSpan(this); 207 if (!autoUninitSpan.uninitDone() && m != NULL) 208 { 209 VBoxExtPackFreeDesc(&m->Desc); 210 211 delete m; 212 m = NULL; 213 } 214 } 215 216 STDMETHODIMP ExtPackFile::COMGETTER(Name)(BSTR *a_pbstrName) 217 { 218 CheckComArgOutPointerValid(a_pbstrName); 219 220 AutoCaller autoCaller(this); 221 HRESULT hrc = autoCaller.rc(); 222 if (SUCCEEDED(hrc)) 223 { 224 Bstr str(m->Desc.strName); 225 str.cloneTo(a_pbstrName); 226 } 227 return hrc; 228 } 229 230 STDMETHODIMP ExtPackFile::COMGETTER(Description)(BSTR *a_pbstrDescription) 231 { 232 CheckComArgOutPointerValid(a_pbstrDescription); 233 234 AutoCaller autoCaller(this); 235 HRESULT hrc = autoCaller.rc(); 236 if (SUCCEEDED(hrc)) 237 { 238 Bstr str(m->Desc.strDescription); 239 str.cloneTo(a_pbstrDescription); 240 } 241 return hrc; 242 } 243 244 STDMETHODIMP ExtPackFile::COMGETTER(Version)(BSTR *a_pbstrVersion) 245 { 246 CheckComArgOutPointerValid(a_pbstrVersion); 247 248 AutoCaller autoCaller(this); 249 HRESULT hrc = autoCaller.rc(); 250 if (SUCCEEDED(hrc)) 251 { 252 Bstr str(m->Desc.strVersion); 253 str.cloneTo(a_pbstrVersion); 254 } 255 return hrc; 256 } 257 258 STDMETHODIMP ExtPackFile::COMGETTER(Revision)(ULONG *a_puRevision) 259 { 260 CheckComArgOutPointerValid(a_puRevision); 261 262 AutoCaller autoCaller(this); 263 HRESULT hrc = autoCaller.rc(); 264 if (SUCCEEDED(hrc)) 265 *a_puRevision = m->Desc.uRevision; 266 return hrc; 267 } 268 269 STDMETHODIMP ExtPackFile::COMGETTER(VRDEModule)(BSTR *a_pbstrVrdeModule) 270 { 271 CheckComArgOutPointerValid(a_pbstrVrdeModule); 272 273 AutoCaller autoCaller(this); 274 HRESULT hrc = autoCaller.rc(); 275 if (SUCCEEDED(hrc)) 276 { 277 Bstr str(m->Desc.strVrdeModule); 278 str.cloneTo(a_pbstrVrdeModule); 279 } 280 return hrc; 281 } 282 283 STDMETHODIMP ExtPackFile::COMGETTER(PlugIns)(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns)) 284 { 285 /** @todo implement plug-ins. */ 286 #ifdef VBOX_WITH_XPCOM 287 NOREF(a_paPlugIns); 288 NOREF(a_paPlugInsSize); 289 #endif 290 ReturnComNotImplemented(); 291 } 292 293 STDMETHODIMP ExtPackFile::COMGETTER(Usable)(BOOL *a_pfUsable) 294 { 295 CheckComArgOutPointerValid(a_pfUsable); 296 297 AutoCaller autoCaller(this); 298 HRESULT hrc = autoCaller.rc(); 299 if (SUCCEEDED(hrc)) 300 *a_pfUsable = m->fUsable; 301 return hrc; 302 } 303 304 STDMETHODIMP ExtPackFile::COMGETTER(WhyUnusable)(BSTR *a_pbstrWhy) 305 { 306 CheckComArgOutPointerValid(a_pbstrWhy); 307 308 AutoCaller autoCaller(this); 309 HRESULT hrc = autoCaller.rc(); 310 if (SUCCEEDED(hrc)) 311 m->strWhyUnusable.cloneTo(a_pbstrWhy); 312 return hrc; 313 } 314 315 STDMETHODIMP ExtPackFile::COMGETTER(FilePath)(BSTR *a_pbstrPath) 316 { 317 CheckComArgOutPointerValid(a_pbstrPath); 318 319 AutoCaller autoCaller(this); 320 HRESULT hrc = autoCaller.rc(); 321 if (SUCCEEDED(hrc)) 322 m->strExtPackFile.cloneTo(a_pbstrPath); 323 return hrc; 324 } 325 326 STDMETHODIMP ExtPackFile::Install(void) 327 { 328 return E_NOTIMPL; 329 } 330 331 332 130 333 131 334 … … 1324 1527 } 1325 1528 1529 STDMETHODIMP ExtPackManager::OpenExtPackFile(IN_BSTR a_bstrTarball, IExtPackFile **a_ppExtPackFile) 1530 { 1531 CheckComArgNotNull(a_bstrTarball); 1532 CheckComArgOutPointerValid(a_ppExtPackFile); 1533 Utf8Str strTarball(a_bstrTarball); 1534 AssertReturn(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON, E_UNEXPECTED); 1535 1536 return E_NOTIMPL; 1537 } 1538 1326 1539 STDMETHODIMP ExtPackManager::Install(IN_BSTR a_bstrTarball, BSTR *a_pbstrName) 1327 1540 { … … 1329 1542 CheckComArgOutPointerValid(a_pbstrName); 1330 1543 Utf8Str strTarball(a_bstrTarball); 1331 Assert (m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON);1544 AssertReturn(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON, E_UNEXPECTED); 1332 1545 1333 1546 AutoCaller autoCaller(this); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r34709 r34714 14334 14334 14335 14335 <interface 14336 name="IExtPack " extends="$unknown"14337 uuid=" 94564309-5966-419a-81cc-4aec0b6dbd4d"14336 name="IExtPackBase" extends="$unknown" 14337 uuid="58304368-f78a-418c-8fec-d9e4e588d797" 14338 14338 wsmap="suppress" 14339 14339 > … … 14367 14367 <attribute name="usable" type="boolean" readonly="yes"> 14368 14368 <desc> 14369 Indicates whether the extension pack is usable or not. An 14370 extension pack that is not compatible with the current VirtualBox 14371 version will be flagged as not usable. 14369 Indicates whether the extension pack is usable or not. 14370 14371 There are a number of reasons why an extension pack might be unusable, 14372 typical examples would be broken installation/file or that it is 14373 incompatible with the current VirtualBox version. 14372 14374 </desc> 14373 14375 </attribute> … … 14378 14380 </desc> 14379 14381 </attribute> 14382 </interface> 14383 14384 <interface 14385 name="IExtPack" extends="IExtPackBase" 14386 uuid="60f0c30f-c773-4d3e-9580-3ffa47c24e95" 14387 wsmap="suppress" 14388 > 14389 <desc> 14390 Interface for querying information about an extension pack as well as 14391 accessing COM objects within it. 14392 </desc> 14380 14393 <method name="queryObject"> 14381 14394 <desc> … … 14394 14407 14395 14408 <interface 14409 name="IExtPackFile" extends="IExtPackBase" 14410 uuid="58509cab-f905-4acb-8087-ba0ab80d8038" 14411 wsmap="suppress" 14412 > 14413 <desc> 14414 Extension pack file (aka tarball, .vbox-extpack) representation returned 14415 by IExtPackManager::openExtPackFile. This provides the base extension 14416 pack information with the addition of the file name. It also provides an 14417 alternative to IExtPackManager::install. 14418 </desc> 14419 <attribute name="filePath" type="wstring" readonly="yes"> 14420 <desc> 14421 The path to the extension pack file. 14422 </desc> 14423 </attribute> 14424 14425 <method name="install"> 14426 <desc> 14427 Install the extension pack. 14428 </desc> 14429 </method> 14430 </interface> 14431 14432 <interface 14396 14433 name="IExtPackManager" extends="$unknown" 14397 uuid=" bc386406-2637-454b-8d55-021f9e20445a"14434 uuid="8104df65-74d6-4e33-b374-50aa062b4afd" 14398 14435 wsmap="suppress" 14399 14436 > … … 14427 14464 </method> 14428 14465 14466 <method name="openExtPackFile"> 14467 <desc> 14468 Attempts to open an extension pack file in preparation for 14469 installation. 14470 </desc> 14471 <param name="path" type="wstring" dir="in"> 14472 <desc>The path of the extension pack tarball.</desc> 14473 </param> 14474 <param name="file" type="IExtPackFile" dir="return"> 14475 <desc>The interface of the extension pack file object.</desc> 14476 </param> 14477 </method> 14478 14429 14479 <method name="install"> 14480 <desc> 14481 Please use openExtPackFile + IExtPackFile::install instead of this 14482 interface. This will be removed later in the beta cycle. 14483 </desc> 14430 14484 <param name="path" type="wstring" dir="in"> 14431 14485 <desc>The path of the extension pack tarball.</desc> … … 14463 14517 <desc>The name of the frontend or component.</desc> 14464 14518 </param> 14465 <param name="plugInModules" type="wstring" dir=" out" safearray="yes">14519 <param name="plugInModules" type="wstring" dir="return" safearray="yes"> 14466 14520 <desc>Array containing the plug-in modules (full paths).</desc> 14467 14521 </param> -
trunk/src/VBox/Main/include/ExtPackManagerImpl.h
r34579 r34714 23 23 #include <iprt/fs.h> 24 24 25 26 25 /** 27 * An extension pack. 28 * 29 * This 30 */ 31 class ATL_NO_VTABLE ExtPack : 26 * An extension pack file. 27 */ 28 class ATL_NO_VTABLE ExtPackFile : 32 29 public VirtualBoxBase, 33 VBOX_SCRIPTABLE_IMPL(IExtPack )30 VBOX_SCRIPTABLE_IMPL(IExtPackFile) 34 31 { 35 32 public: 36 33 /** @name COM and internal init/term/mapping cruft. 37 34 * @{ */ 38 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPack , IExtPack)39 DECLARE_NOT_AGGREGATABLE(ExtPack )35 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackFile, IExtPackFile) 36 DECLARE_NOT_AGGREGATABLE(ExtPackFile) 40 37 DECLARE_PROTECT_FINAL_CONSTRUCT() 41 BEGIN_COM_MAP(ExtPack )38 BEGIN_COM_MAP(ExtPackFile) 42 39 COM_INTERFACE_ENTRY(ISupportErrorInfo) 43 COM_INTERFACE_ENTRY(IExtPack) 40 COM_INTERFACE_ENTRY(IExtPackFile) 41 COM_INTERFACE_ENTRY(IExtPackBase) 44 42 COM_INTERFACE_ENTRY(IDispatch) 45 43 END_COM_MAP() 46 DECLARE_EMPTY_CTOR_DTOR(ExtPack )44 DECLARE_EMPTY_CTOR_DTOR(ExtPackFile) 47 45 48 46 HRESULT FinalConstruct(); 49 47 void FinalRelease(); 50 HRESULT initWith Dir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName, const char *a_pszDir);48 HRESULT initWithFile(const char *a_pszFile); 51 49 void uninit(); 52 50 /** @} */ 53 51 54 /** @name IExtPack interfaces52 /** @name IExtPackBase interfaces 55 53 * @{ */ 56 54 STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName); … … 62 60 STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable); 63 61 STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy); 62 /** @} */ 63 64 /** @name IExtPackFile interfaces 65 * @{ */ 66 STDMETHOD(COMGETTER(FilePath))(BSTR *a_pbstrPath); 67 STDMETHOD(Install)(void); 68 /** @} */ 69 70 private: 71 struct Data; 72 /** Pointer to the private instance. */ 73 Data *m; 74 75 friend class ExtPackManager; 76 }; 77 78 79 /** 80 * An installed extension pack. 81 */ 82 class ATL_NO_VTABLE ExtPack : 83 public VirtualBoxBase, 84 VBOX_SCRIPTABLE_IMPL(IExtPack) 85 { 86 public: 87 /** @name COM and internal init/term/mapping cruft. 88 * @{ */ 89 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPack, IExtPack) 90 DECLARE_NOT_AGGREGATABLE(ExtPack) 91 DECLARE_PROTECT_FINAL_CONSTRUCT() 92 BEGIN_COM_MAP(ExtPack) 93 COM_INTERFACE_ENTRY(ISupportErrorInfo) 94 COM_INTERFACE_ENTRY(IExtPack) 95 COM_INTERFACE_ENTRY(IExtPackBase) 96 COM_INTERFACE_ENTRY(IDispatch) 97 END_COM_MAP() 98 DECLARE_EMPTY_CTOR_DTOR(ExtPack) 99 100 HRESULT FinalConstruct(); 101 void FinalRelease(); 102 HRESULT initWithDir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName, const char *a_pszDir); 103 void uninit(); 104 /** @} */ 105 106 /** @name IExtPackBase interfaces 107 * @{ */ 108 STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName); 109 STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription); 110 STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion); 111 STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision); 112 STDMETHOD(COMGETTER(VRDEModule))(BSTR *a_pbstrVrdeModule); 113 STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns)); 114 STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable); 115 STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy); 116 /** @} */ 117 118 /** @name IExtPack interfaces 119 * @{ */ 64 120 STDMETHOD(QueryObject)(IN_BSTR a_bstrObjectId, IUnknown **a_ppUnknown); 65 121 /** @} */ … … 138 194 STDMETHOD(COMGETTER(InstalledExtPacks))(ComSafeArrayOut(IExtPack *, a_paExtPacks)); 139 195 STDMETHOD(Find)(IN_BSTR a_bstrName, IExtPack **a_pExtPack); 196 STDMETHOD(OpenExtPackFile)(IN_BSTR a_bstrTarball, IExtPackFile **a_ppExtPackFile); 140 197 STDMETHOD(Install)(IN_BSTR a_bstrTarball, BSTR *a_pbstrName); 141 198 STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval); -
trunk/src/VBox/Main/xpcom/module.cpp
r34647 r34714 77 77 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServerInfo, IVRDEServerInfo) 78 78 #ifdef VBOX_WITH_EXTPACK 79 NS_DECL_CLASSINFO(ExtPackFile) 80 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackFile, IExtPack) 79 81 NS_DECL_CLASSINFO(ExtPack) 80 82 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPack, IExtPack) -
trunk/src/VBox/Main/xpcom/server.cpp
r34587 r34714 207 207 208 208 #ifdef VBOX_WITH_EXTPACK 209 NS_DECL_CLASSINFO(ExtPackFile) 210 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackFile, IExtPackFile) 211 209 212 NS_DECL_CLASSINFO(ExtPack) 210 213 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPack, IExtPack)
Note:
See TracChangeset
for help on using the changeset viewer.