Bug 1608150 [wpt PR 21112] - Add missing space in `./wpt lint` command line docs...
[gecko.git] / caps / NullPrincipalURI.h
blobd8cc5e0b5b2ffc1324cdba0673d67776c0f8945f
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=2 sts=2 expandtab
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 /**
8 * This wraps nsSimpleURI so that all calls to it are done on the main thread.
9 */
11 #ifndef mozilla_NullPrincipalURI_h
12 #define mozilla_NullPrincipalURI_h
14 #include "nsIURI.h"
15 #include "nsISizeOf.h"
16 #include "nsString.h"
17 #include "mozilla/Attributes.h"
18 #include "mozilla/MemoryReporting.h"
19 #include "NullPrincipal.h"
20 #include "nsID.h"
21 #include "nsIURIMutator.h"
23 // {51fcd543-3b52-41f7-b91b-6b54102236e6}
24 #define NS_NULLPRINCIPALURI_IMPLEMENTATION_CID \
25 { \
26 0x51fcd543, 0x3b52, 0x41f7, { \
27 0xb9, 0x1b, 0x6b, 0x54, 0x10, 0x22, 0x36, 0xe6 \
28 } \
31 namespace mozilla {
33 class Encoding;
35 class NullPrincipalURI final : public nsIURI, public nsISizeOf {
36 public:
37 NS_DECL_THREADSAFE_ISUPPORTS
38 NS_DECL_NSIURI
40 NullPrincipalURI();
42 // nsISizeOf
43 virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
44 virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
46 private:
47 NullPrincipalURI(const NullPrincipalURI& aOther);
49 ~NullPrincipalURI() {}
51 nsAutoCStringN<NSID_LENGTH> mPath;
53 nsresult Clone(nsIURI** aURI);
54 nsresult SetSpecInternal(const nsACString& input);
55 nsresult SetScheme(const nsACString& input);
56 nsresult SetUserPass(const nsACString& input);
57 nsresult SetUsername(const nsACString& input);
58 nsresult SetPassword(const nsACString& input);
59 nsresult SetHostPort(const nsACString& aValue);
60 nsresult SetHost(const nsACString& input);
61 nsresult SetPort(int32_t port);
62 nsresult SetPathQueryRef(const nsACString& input);
63 nsresult SetRef(const nsACString& input);
64 nsresult SetFilePath(const nsACString& input);
65 nsresult SetQuery(const nsACString& input);
66 nsresult SetQueryWithEncoding(const nsACString& input,
67 const Encoding* encoding);
68 bool Deserialize(const mozilla::ipc::URIParams&);
70 public:
71 class Mutator final : public nsIURIMutator,
72 public BaseURIMutator<NullPrincipalURI> {
73 NS_DECL_ISUPPORTS
74 NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
76 NS_IMETHOD Deserialize(const mozilla::ipc::URIParams& aParams) override {
77 return InitFromIPCParams(aParams);
80 NS_IMETHOD Finalize(nsIURI** aURI) override {
81 mURI.forget(aURI);
82 return NS_OK;
85 NS_IMETHOD SetSpec(const nsACString& aSpec,
86 nsIURIMutator** aMutator) override {
87 if (aMutator) {
88 nsCOMPtr<nsIURIMutator> mutator = this;
89 mutator.forget(aMutator);
91 return NS_ERROR_NOT_IMPLEMENTED;
94 explicit Mutator() {}
96 private:
97 virtual ~Mutator() {}
99 friend class NullPrincipalURI;
102 friend class BaseURIMutator<NullPrincipalURI>;
105 } // namespace mozilla
107 #endif // mozilla_NullPrincipalURI_h