Bug 1526591 - Remove devtools.inspector.shapesHighlighter.enabled pref. r=rcaliman
[gecko.git] / netwerk / base / nsProxyInfo.cpp
blob4422c0c3fcde7206721620c58a8342ba9d21eecc
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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 "nsProxyInfo.h"
8 #include "nsCOMPtr.h"
10 namespace mozilla {
11 namespace net {
13 // Yes, we support QI to nsProxyInfo
14 NS_IMPL_ISUPPORTS(nsProxyInfo, nsProxyInfo, nsIProxyInfo)
16 NS_IMETHODIMP
17 nsProxyInfo::GetHost(nsACString &result) {
18 result = mHost;
19 return NS_OK;
22 NS_IMETHODIMP
23 nsProxyInfo::GetPort(int32_t *result) {
24 *result = mPort;
25 return NS_OK;
28 NS_IMETHODIMP
29 nsProxyInfo::GetType(nsACString &result) {
30 result = mType;
31 return NS_OK;
34 NS_IMETHODIMP
35 nsProxyInfo::GetFlags(uint32_t *result) {
36 *result = mFlags;
37 return NS_OK;
40 NS_IMETHODIMP
41 nsProxyInfo::GetResolveFlags(uint32_t *result) {
42 *result = mResolveFlags;
43 return NS_OK;
46 NS_IMETHODIMP
47 nsProxyInfo::GetUsername(nsACString &result) {
48 result = mUsername;
49 return NS_OK;
52 NS_IMETHODIMP
53 nsProxyInfo::GetPassword(nsACString &result) {
54 result = mPassword;
55 return NS_OK;
58 NS_IMETHODIMP
59 nsProxyInfo::GetFailoverTimeout(uint32_t *result) {
60 *result = mTimeout;
61 return NS_OK;
64 NS_IMETHODIMP
65 nsProxyInfo::GetFailoverProxy(nsIProxyInfo **result) {
66 NS_IF_ADDREF(*result = mNext);
67 return NS_OK;
70 NS_IMETHODIMP
71 nsProxyInfo::SetFailoverProxy(nsIProxyInfo *proxy) {
72 nsCOMPtr<nsProxyInfo> pi = do_QueryInterface(proxy);
73 NS_ENSURE_ARG(pi);
75 pi.swap(mNext);
76 return NS_OK;
79 // These pointers are declared in nsProtocolProxyService.cpp and
80 // comparison of mType by string pointer is valid within necko
81 extern const char kProxyType_HTTP[];
82 extern const char kProxyType_HTTPS[];
83 extern const char kProxyType_SOCKS[];
84 extern const char kProxyType_SOCKS4[];
85 extern const char kProxyType_SOCKS5[];
86 extern const char kProxyType_DIRECT[];
88 bool nsProxyInfo::IsDirect() {
89 if (!mType) return true;
90 return mType == kProxyType_DIRECT;
93 bool nsProxyInfo::IsHTTP() { return mType == kProxyType_HTTP; }
95 bool nsProxyInfo::IsHTTPS() { return mType == kProxyType_HTTPS; }
97 bool nsProxyInfo::IsSOCKS() {
98 return mType == kProxyType_SOCKS || mType == kProxyType_SOCKS4 ||
99 mType == kProxyType_SOCKS5;
102 } // namespace net
103 } // namespace mozilla