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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef SubstitutingURL_h
8 #define SubstitutingURL_h
10 #include "nsStandardURL.h"
17 // SubstitutingURL : overrides nsStandardURL::GetFile to provide nsIFile
19 class SubstitutingURL
: public nsStandardURL
{
21 NS_DECL_ISUPPORTS_INHERITED
22 virtual nsStandardURL
* StartClone() override
;
23 [[nodiscard
]] virtual nsresult
EnsureFile() override
;
26 explicit SubstitutingURL() : nsStandardURL(true) {}
27 explicit SubstitutingURL(bool aSupportsFileURL
) : nsStandardURL(true) {
28 MOZ_ASSERT(aSupportsFileURL
);
30 virtual nsresult
Clone(nsIURI
** aURI
) override
{
31 return nsStandardURL::Clone(aURI
);
33 virtual ~SubstitutingURL() = default;
36 class Mutator
: public TemplatedMutator
<SubstitutingURL
> {
39 explicit Mutator() = default;
42 virtual ~Mutator() = default;
44 SubstitutingURL
* Create() override
{ return new SubstitutingURL(); }
47 NS_IMETHOD
Mutate(nsIURIMutator
** aMutator
) override
{
48 RefPtr
<SubstitutingURL::Mutator
> mutator
= new SubstitutingURL::Mutator();
49 nsresult rv
= mutator
->InitFromURI(this);
53 mutator
.forget(aMutator
);
57 NS_IMETHOD_(void) Serialize(ipc::URIParams
& aParams
) override
;
59 friend BaseURIMutator
<SubstitutingURL
>;
60 friend TemplatedMutator
<SubstitutingURL
>;
64 } // namespace mozilla
66 #endif /* SubstitutingURL_h */