1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "ProxyConfigLookupChild.h"
9 #include "mozilla/net/SocketProcessChild.h"
10 #include "nsProxyInfo.h"
16 bool ProxyConfigLookupChild::Create(
17 nsIURI
* aURI
, uint32_t aProxyResolveFlags
,
18 std::function
<void(nsIProxyInfo
*, nsresult
)>&& aCallback
) {
19 SocketProcessChild
* socketChild
= SocketProcessChild::GetSingleton();
24 RefPtr
<ProxyConfigLookupChild
> child
=
25 new ProxyConfigLookupChild(std::move(aCallback
));
26 return socketChild
->SendPProxyConfigLookupConstructor(child
, aURI
,
30 ProxyConfigLookupChild::ProxyConfigLookupChild(
31 std::function
<void(nsIProxyInfo
*, nsresult
)>&& aCallback
)
32 : mCallback(std::move(aCallback
)) {}
34 mozilla::ipc::IPCResult
ProxyConfigLookupChild::Recv__delete__(
35 nsTArray
<ProxyInfoCloneArgs
>&& aProxyInfo
, const nsresult
& aResult
) {
36 nsCOMPtr
<nsIProxyInfo
> proxyInfo
=
37 nsProxyInfo::DeserializeProxyInfo(aProxyInfo
);
38 mCallback(proxyInfo
, aResult
);
43 } // namespace mozilla