Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsXPCOM_h__ |
michael@0 | 7 | #include "nsXPCOM.h" |
michael@0 | 8 | #endif |
michael@0 | 9 | |
michael@0 | 10 | #ifndef nsCOMPtr_h__ |
michael@0 | 11 | #include "nsCOMPtr.h" |
michael@0 | 12 | #endif |
michael@0 | 13 | |
michael@0 | 14 | #include "nsComponentManagerUtils.h" |
michael@0 | 15 | #include "nsServiceManagerUtils.h" |
michael@0 | 16 | |
michael@0 | 17 | #include "nsIComponentManager.h" |
michael@0 | 18 | |
michael@0 | 19 | #ifndef MOZILLA_INTERNAL_API |
michael@0 | 20 | |
michael@0 | 21 | nsresult |
michael@0 | 22 | CallGetService(const nsCID &aCID, const nsIID &aIID, void **aResult) |
michael@0 | 23 | { |
michael@0 | 24 | nsCOMPtr<nsIServiceManager> servMgr; |
michael@0 | 25 | nsresult status = NS_GetServiceManager(getter_AddRefs(servMgr)); |
michael@0 | 26 | if (servMgr) |
michael@0 | 27 | status = servMgr->GetService(aCID, aIID, aResult); |
michael@0 | 28 | return status; |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | nsresult |
michael@0 | 32 | CallGetService(const char *aContractID, const nsIID &aIID, void **aResult) |
michael@0 | 33 | { |
michael@0 | 34 | nsCOMPtr<nsIServiceManager> servMgr; |
michael@0 | 35 | nsresult status = NS_GetServiceManager(getter_AddRefs(servMgr)); |
michael@0 | 36 | if (servMgr) |
michael@0 | 37 | status = servMgr->GetServiceByContractID(aContractID, aIID, aResult); |
michael@0 | 38 | return status; |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | #else |
michael@0 | 42 | |
michael@0 | 43 | #include "nsComponentManager.h" |
michael@0 | 44 | |
michael@0 | 45 | nsresult |
michael@0 | 46 | CallGetService(const nsCID &aCID, const nsIID &aIID, void **aResult) |
michael@0 | 47 | { |
michael@0 | 48 | nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager; |
michael@0 | 49 | if (NS_WARN_IF(!compMgr)) |
michael@0 | 50 | return NS_ERROR_NOT_INITIALIZED; |
michael@0 | 51 | |
michael@0 | 52 | return compMgr->nsComponentManagerImpl::GetService(aCID, aIID, aResult); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | nsresult |
michael@0 | 56 | CallGetService(const char *aContractID, const nsIID &aIID, void **aResult) |
michael@0 | 57 | { |
michael@0 | 58 | nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager; |
michael@0 | 59 | if (NS_WARN_IF(!compMgr)) |
michael@0 | 60 | return NS_ERROR_NOT_INITIALIZED; |
michael@0 | 61 | |
michael@0 | 62 | return compMgr-> |
michael@0 | 63 | nsComponentManagerImpl::GetServiceByContractID(aContractID, |
michael@0 | 64 | aIID, aResult); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | #endif |
michael@0 | 68 | |
michael@0 | 69 | #ifndef MOZILLA_INTERNAL_API |
michael@0 | 70 | |
michael@0 | 71 | nsresult |
michael@0 | 72 | CallCreateInstance(const nsCID &aCID, nsISupports *aDelegate, |
michael@0 | 73 | const nsIID &aIID, void **aResult) |
michael@0 | 74 | { |
michael@0 | 75 | nsCOMPtr<nsIComponentManager> compMgr; |
michael@0 | 76 | nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr)); |
michael@0 | 77 | if (compMgr) |
michael@0 | 78 | status = compMgr->CreateInstance(aCID, aDelegate, aIID, aResult); |
michael@0 | 79 | return status; |
michael@0 | 80 | } |
michael@0 | 81 | |
michael@0 | 82 | nsresult |
michael@0 | 83 | CallCreateInstance(const char *aContractID, nsISupports *aDelegate, |
michael@0 | 84 | const nsIID &aIID, void **aResult) |
michael@0 | 85 | { |
michael@0 | 86 | nsCOMPtr<nsIComponentManager> compMgr; |
michael@0 | 87 | nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr)); |
michael@0 | 88 | if (compMgr) |
michael@0 | 89 | status = compMgr->CreateInstanceByContractID(aContractID, aDelegate, |
michael@0 | 90 | aIID, aResult); |
michael@0 | 91 | return status; |
michael@0 | 92 | } |
michael@0 | 93 | |
michael@0 | 94 | nsresult |
michael@0 | 95 | CallGetClassObject(const nsCID &aCID, const nsIID &aIID, void **aResult) |
michael@0 | 96 | { |
michael@0 | 97 | nsCOMPtr<nsIComponentManager> compMgr; |
michael@0 | 98 | nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr)); |
michael@0 | 99 | if (compMgr) |
michael@0 | 100 | status = compMgr->GetClassObject(aCID, aIID, aResult); |
michael@0 | 101 | return status; |
michael@0 | 102 | } |
michael@0 | 103 | |
michael@0 | 104 | nsresult |
michael@0 | 105 | CallGetClassObject(const char *aContractID, const nsIID &aIID, void **aResult) |
michael@0 | 106 | { |
michael@0 | 107 | nsCOMPtr<nsIComponentManager> compMgr; |
michael@0 | 108 | nsresult status = NS_GetComponentManager(getter_AddRefs(compMgr)); |
michael@0 | 109 | if (compMgr) |
michael@0 | 110 | status = compMgr->GetClassObjectByContractID(aContractID, aIID, |
michael@0 | 111 | aResult); |
michael@0 | 112 | return status; |
michael@0 | 113 | } |
michael@0 | 114 | |
michael@0 | 115 | #else |
michael@0 | 116 | |
michael@0 | 117 | #include "nsComponentManager.h" |
michael@0 | 118 | |
michael@0 | 119 | nsresult |
michael@0 | 120 | CallCreateInstance(const nsCID &aCID, nsISupports *aDelegate, |
michael@0 | 121 | const nsIID &aIID, void **aResult) |
michael@0 | 122 | { |
michael@0 | 123 | nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager; |
michael@0 | 124 | if (NS_WARN_IF(!compMgr)) |
michael@0 | 125 | return NS_ERROR_NOT_INITIALIZED; |
michael@0 | 126 | |
michael@0 | 127 | return compMgr-> |
michael@0 | 128 | nsComponentManagerImpl::CreateInstance(aCID, aDelegate, aIID, aResult); |
michael@0 | 129 | } |
michael@0 | 130 | |
michael@0 | 131 | nsresult |
michael@0 | 132 | CallCreateInstance(const char *aContractID, nsISupports *aDelegate, |
michael@0 | 133 | const nsIID &aIID, void **aResult) |
michael@0 | 134 | { |
michael@0 | 135 | nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager; |
michael@0 | 136 | if (NS_WARN_IF(!compMgr)) |
michael@0 | 137 | return NS_ERROR_NOT_INITIALIZED; |
michael@0 | 138 | |
michael@0 | 139 | return compMgr-> |
michael@0 | 140 | nsComponentManagerImpl::CreateInstanceByContractID(aContractID, |
michael@0 | 141 | aDelegate, aIID, |
michael@0 | 142 | aResult); |
michael@0 | 143 | } |
michael@0 | 144 | |
michael@0 | 145 | nsresult |
michael@0 | 146 | CallGetClassObject(const nsCID &aCID, const nsIID &aIID, void **aResult) |
michael@0 | 147 | { |
michael@0 | 148 | nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager; |
michael@0 | 149 | if (NS_WARN_IF(!compMgr)) |
michael@0 | 150 | return NS_ERROR_NOT_INITIALIZED; |
michael@0 | 151 | |
michael@0 | 152 | return compMgr-> |
michael@0 | 153 | nsComponentManagerImpl::GetClassObject(aCID, aIID, aResult); |
michael@0 | 154 | } |
michael@0 | 155 | |
michael@0 | 156 | nsresult |
michael@0 | 157 | CallGetClassObject(const char *aContractID, const nsIID &aIID, void **aResult) |
michael@0 | 158 | { |
michael@0 | 159 | nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager; |
michael@0 | 160 | if (NS_WARN_IF(!compMgr)) |
michael@0 | 161 | return NS_ERROR_NOT_INITIALIZED; |
michael@0 | 162 | |
michael@0 | 163 | return compMgr-> |
michael@0 | 164 | nsComponentManagerImpl::GetClassObjectByContractID(aContractID, aIID, |
michael@0 | 165 | aResult); |
michael@0 | 166 | } |
michael@0 | 167 | |
michael@0 | 168 | #endif |
michael@0 | 169 | |
michael@0 | 170 | nsresult |
michael@0 | 171 | nsCreateInstanceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const |
michael@0 | 172 | { |
michael@0 | 173 | nsresult status = CallCreateInstance(mCID, mOuter, aIID, aInstancePtr); |
michael@0 | 174 | if ( NS_FAILED(status) ) |
michael@0 | 175 | *aInstancePtr = 0; |
michael@0 | 176 | if ( mErrorPtr ) |
michael@0 | 177 | *mErrorPtr = status; |
michael@0 | 178 | return status; |
michael@0 | 179 | } |
michael@0 | 180 | |
michael@0 | 181 | nsresult |
michael@0 | 182 | nsCreateInstanceByContractID::operator()( const nsIID& aIID, void** aInstancePtr ) const |
michael@0 | 183 | { |
michael@0 | 184 | nsresult status = CallCreateInstance(mContractID, mOuter, aIID, aInstancePtr); |
michael@0 | 185 | if (NS_FAILED(status)) |
michael@0 | 186 | *aInstancePtr = 0; |
michael@0 | 187 | if ( mErrorPtr ) |
michael@0 | 188 | *mErrorPtr = status; |
michael@0 | 189 | return status; |
michael@0 | 190 | } |
michael@0 | 191 | |
michael@0 | 192 | nsresult |
michael@0 | 193 | nsCreateInstanceFromFactory::operator()( const nsIID& aIID, void** aInstancePtr ) const |
michael@0 | 194 | { |
michael@0 | 195 | nsresult status = mFactory->CreateInstance(mOuter, aIID, aInstancePtr); |
michael@0 | 196 | if ( NS_FAILED(status) ) |
michael@0 | 197 | *aInstancePtr = 0; |
michael@0 | 198 | if ( mErrorPtr ) |
michael@0 | 199 | *mErrorPtr = status; |
michael@0 | 200 | return status; |
michael@0 | 201 | } |
michael@0 | 202 | |
michael@0 | 203 | |
michael@0 | 204 | nsresult |
michael@0 | 205 | nsGetClassObjectByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const |
michael@0 | 206 | { |
michael@0 | 207 | nsresult status = CallGetClassObject(mCID, aIID, aInstancePtr); |
michael@0 | 208 | if ( NS_FAILED(status) ) |
michael@0 | 209 | *aInstancePtr = 0; |
michael@0 | 210 | if ( mErrorPtr ) |
michael@0 | 211 | *mErrorPtr = status; |
michael@0 | 212 | return status; |
michael@0 | 213 | } |
michael@0 | 214 | |
michael@0 | 215 | nsresult |
michael@0 | 216 | nsGetClassObjectByContractID::operator()( const nsIID& aIID, void** aInstancePtr ) const |
michael@0 | 217 | { |
michael@0 | 218 | nsresult status = CallGetClassObject(mContractID, aIID, aInstancePtr); |
michael@0 | 219 | if ( NS_FAILED(status) ) |
michael@0 | 220 | *aInstancePtr = 0; |
michael@0 | 221 | if ( mErrorPtr ) |
michael@0 | 222 | *mErrorPtr = status; |
michael@0 | 223 | return status; |
michael@0 | 224 | } |
michael@0 | 225 | |
michael@0 | 226 | |
michael@0 | 227 | nsresult |
michael@0 | 228 | nsGetServiceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const |
michael@0 | 229 | { |
michael@0 | 230 | nsresult status = CallGetService(mCID, aIID, aInstancePtr); |
michael@0 | 231 | if ( NS_FAILED(status) ) |
michael@0 | 232 | *aInstancePtr = 0; |
michael@0 | 233 | |
michael@0 | 234 | return status; |
michael@0 | 235 | } |
michael@0 | 236 | |
michael@0 | 237 | nsresult |
michael@0 | 238 | nsGetServiceByCIDWithError::operator()( const nsIID& aIID, void** aInstancePtr ) const |
michael@0 | 239 | { |
michael@0 | 240 | nsresult status = CallGetService(mCID, aIID, aInstancePtr); |
michael@0 | 241 | if ( NS_FAILED(status) ) |
michael@0 | 242 | *aInstancePtr = 0; |
michael@0 | 243 | |
michael@0 | 244 | if ( mErrorPtr ) |
michael@0 | 245 | *mErrorPtr = status; |
michael@0 | 246 | return status; |
michael@0 | 247 | } |
michael@0 | 248 | |
michael@0 | 249 | nsresult |
michael@0 | 250 | nsGetServiceByContractID::operator()( const nsIID& aIID, void** aInstancePtr ) const |
michael@0 | 251 | { |
michael@0 | 252 | nsresult status = CallGetService(mContractID, aIID, aInstancePtr); |
michael@0 | 253 | if ( NS_FAILED(status) ) |
michael@0 | 254 | *aInstancePtr = 0; |
michael@0 | 255 | |
michael@0 | 256 | return status; |
michael@0 | 257 | } |
michael@0 | 258 | |
michael@0 | 259 | nsresult |
michael@0 | 260 | nsGetServiceByContractIDWithError::operator()( const nsIID& aIID, void** aInstancePtr ) const |
michael@0 | 261 | { |
michael@0 | 262 | nsresult status = CallGetService(mContractID, aIID, aInstancePtr); |
michael@0 | 263 | if ( NS_FAILED(status) ) |
michael@0 | 264 | *aInstancePtr = 0; |
michael@0 | 265 | |
michael@0 | 266 | if ( mErrorPtr ) |
michael@0 | 267 | *mErrorPtr = status; |
michael@0 | 268 | return status; |
michael@0 | 269 | } |