Bug 1930123 - Add missing steps to homeMainMenuItemsTest UI test r=aaronmt
[gecko.git] / netwerk / ipc / ProxyConfigLookupChild.cpp
blob913b8460c24db110bb6da4e6f975e1839012e801
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"
12 namespace mozilla {
13 namespace net {
15 // static
16 bool ProxyConfigLookupChild::Create(
17 nsIURI* aURI, uint32_t aProxyResolveFlags,
18 std::function<void(nsIProxyInfo*, nsresult)>&& aCallback) {
19 SocketProcessChild* socketChild = SocketProcessChild::GetSingleton();
20 if (!socketChild) {
21 return false;
24 RefPtr<ProxyConfigLookupChild> child =
25 new ProxyConfigLookupChild(std::move(aCallback));
26 return socketChild->SendPProxyConfigLookupConstructor(child, aURI,
27 aProxyResolveFlags);
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);
39 return IPC_OK();
42 } // namespace net
43 } // namespace mozilla