- Timestamp:
- Aug 7, 2018 3:19:57 PM (6 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/CloudUserProfileManagerImpl.h
r73337 r73549 41 41 private: 42 42 ComPtr<VirtualBox> const mParent; /**< Strong reference to the parent object (VirtualBox/IMachine). */ 43 #ifdef CLOUD_PROVIDERS_IN_EXTPACK 44 std::vector<ComPtr<ICloudUserProfileManager>> mUserProfileManagers; 45 #else 43 46 std::vector<CloudProviderId_T> mSupportedProviders; 47 #endif 44 48 45 49 HRESULT getSupportedProviders(std::vector<CloudProviderId_T> &aProviderTypes); -
trunk/src/VBox/Main/src-server/CloudUserProfileManagerImpl.cpp
r73337 r73549 25 25 #include "CloudUserProfilesImpl.h" 26 26 #include "VirtualBoxImpl.h" 27 #include "ExtPackManagerImpl.h" 27 28 #include "Global.h" 28 29 #include "ProgressImpl.h" … … 67 68 68 69 unconst(mParent) = aParent; 70 71 #ifdef CLOUD_PROVIDERS_IN_EXTPACK 72 /* 73 * Engage the extension pack manager and get all the implementations of this class. 74 */ 75 ExtPackManager *pExtPackMgr = aParent->i_getExtPackManager(); 76 std::vector<ComPtr<IUnknown> > Objects; 77 com::Guid idObj(COM_IIDOF(ICloudUserProfileManager)); 78 pExtPackMgr->i_queryObjects(idObj.toString(), Objects); 79 for (unsigned i = 0; i < Objects.size(); i++) 80 { 81 ComPtr<ICloudUserProfileManager> ptrTmp; 82 HRESULT hrc = Objects[i].queryInterfaceTo(ptrTmp.asOutParam()); 83 if (SUCCEEDED(hrc)) 84 mUserProfileManagers.push_back(ptrTmp); 85 } 86 #else 87 69 88 mSupportedProviders.clear(); 70 89 mSupportedProviders.push_back(CloudProviderId_OCI); 90 #endif 71 91 72 92 autoInitSpan.setSucceeded(); … … 86 106 HRESULT CloudUserProfileManager::getSupportedProviders(std::vector<CloudProviderId_T> &aSupportedProviders) 87 107 { 108 #ifdef CLOUD_PROVIDERS_IN_EXTPACK 109 /* 110 * Collect all the provider names from all the extension pack objects. 111 */ 112 HRESULT hrc = S_OK; 113 for (unsigned i = 0; i < mUserProfileManagers.size(); i++) 114 { 115 SafeArray<CloudProviderId_T> FromCurrent; 116 HRESULT hrc2 = mUserProfileManagers[i]->COMGETTER(SupportedProviders)(ComSafeArrayAsOutParam(FromCurrent)); 117 if (SUCCEEDED(hrc2)) 118 for (size_t i = 0; i < FromCurrent.size(); i++) 119 aSupportedProviders.push_back(FromCurrent[i]); 120 else if (SUCCEEDED(hrc)) 121 hrc = hrc2; 122 } 123 if (aSupportedProviders.size() > 0) 124 hrc = S_OK; 125 return hrc; 126 #else 88 127 aSupportedProviders = mSupportedProviders; 89 128 return S_OK; 129 #endif 90 130 } 91 131 92 132 HRESULT CloudUserProfileManager::getAllProfiles(std::vector<ComPtr<ICloudUserProfiles> > &aProfilesList) 93 133 { 134 #ifdef CLOUD_PROVIDERS_IN_EXTPACK 135 /* 136 * Collect all the cloud providers from all the extension pack objects. 137 */ 138 HRESULT hrc = S_OK; 139 for (unsigned i = 0; i < mUserProfileManagers.size(); i++) 140 { 141 SafeIfaceArray<ICloudUserProfiles> FromCurrent; 142 HRESULT hrc2 = mUserProfileManagers[i]->GetAllProfiles(ComSafeArrayAsOutParam(FromCurrent)); 143 if (SUCCEEDED(hrc2)) 144 for (size_t i = 0; i < FromCurrent.size(); i++) 145 aProfilesList.push_back(FromCurrent[i]); 146 else if (SUCCEEDED(hrc)) 147 hrc = hrc2; 148 } 149 if (aProfilesList.size() > 0) 150 hrc = S_OK; 151 return hrc; 152 153 #else 94 154 HRESULT hrc = S_OK; 95 155 std::vector<ComPtr<ICloudUserProfiles> > lProfilesList; … … 108 168 109 169 return hrc; 170 #endif 110 171 } 111 172 … … 113 174 ComPtr<ICloudUserProfiles> &aProfiles) 114 175 { 176 #ifdef CLOUD_PROVIDERS_IN_EXTPACK 177 /* 178 * Return the first provider we get. 179 */ 180 HRESULT hrc = VBOX_E_OBJECT_NOT_FOUND; 181 for (unsigned i = 0; i < mUserProfileManagers.size(); i++) 182 { 183 hrc = mUserProfileManagers[i]->GetProfilesByProvider(aProviderType, aProfiles.asOutParam()); 184 if (SUCCEEDED(hrc)) 185 break; 186 } 187 return hrc; 188 189 #else 190 115 191 ComObjPtr<CloudUserProfiles> ptrCloudUserProfiles; 116 192 HRESULT hrc = ptrCloudUserProfiles.createObject(); … … 158 234 159 235 return hrc; 160 } 161 236 #endif 237 } 238
Note:
See TracChangeset
for help on using the changeset viewer.