2006-06-19 21:02:12 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-06-19 21:02:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* URI class to be used for cases when a simple URI actually resolves to some
|
|
|
|
* other sort of URI, with the latter being what's loaded when the load
|
2018-05-09 16:21:24 +00:00
|
|
|
* happens.
|
2006-06-19 21:02:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsSimpleNestedURI_h__
|
|
|
|
#define nsSimpleNestedURI_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsSimpleURI.h"
|
|
|
|
#include "nsINestedURI.h"
|
2017-11-20 16:11:30 +00:00
|
|
|
#include "nsIURIMutator.h"
|
2006-06-19 21:02:12 +00:00
|
|
|
|
2015-03-06 21:33:00 +00:00
|
|
|
#include "nsIIPCSerializableURI.h"
|
|
|
|
|
2016-05-19 02:02:57 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2006-06-19 21:02:12 +00:00
|
|
|
class nsSimpleNestedURI : public nsSimpleURI,
|
|
|
|
public nsINestedURI
|
|
|
|
{
|
2014-06-24 16:36:44 +00:00
|
|
|
protected:
|
2018-03-20 22:23:31 +00:00
|
|
|
nsSimpleNestedURI() = default;
|
2018-03-20 14:45:34 +00:00
|
|
|
explicit nsSimpleNestedURI(nsIURI* innerURI);
|
|
|
|
|
2018-03-20 22:23:31 +00:00
|
|
|
~nsSimpleNestedURI() = default;
|
|
|
|
public:
|
2006-06-19 21:02:12 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_NSINESTEDURI
|
|
|
|
|
|
|
|
// Overrides for various methods nsSimpleURI implements follow.
|
2017-07-06 12:00:35 +00:00
|
|
|
|
2011-05-22 01:12:45 +00:00
|
|
|
// nsSimpleURI overrides
|
|
|
|
virtual nsresult EqualsInternal(nsIURI* other,
|
|
|
|
RefHandlingEnum refHandlingMode,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool* result) override;
|
2016-07-26 22:38:46 +00:00
|
|
|
virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode,
|
|
|
|
const nsACString& newRef) override;
|
2017-11-20 16:11:30 +00:00
|
|
|
NS_IMETHOD Mutate(nsIURIMutator * *_retval) override;
|
2006-06-19 21:02:12 +00:00
|
|
|
|
|
|
|
// nsISerializable overrides
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD Read(nsIObjectInputStream* aStream) override;
|
|
|
|
NS_IMETHOD Write(nsIObjectOutputStream* aStream) override;
|
2006-06-19 21:02:12 +00:00
|
|
|
|
2015-03-06 21:33:00 +00:00
|
|
|
// nsIIPCSerializableURI overrides
|
|
|
|
NS_DECL_NSIIPCSERIALIZABLEURI
|
|
|
|
|
2006-06-19 21:02:12 +00:00
|
|
|
// Override the nsIClassInfo method GetClassIDNoAlloc to make sure our
|
|
|
|
// nsISerializable impl works right.
|
2017-07-06 12:00:35 +00:00
|
|
|
NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) override;
|
2006-06-19 21:02:12 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIURI> mInnerURI;
|
2017-11-20 16:11:30 +00:00
|
|
|
|
2018-05-12 14:30:07 +00:00
|
|
|
nsresult SetPathQueryRef(const nsACString &aPathQueryRef) override;
|
|
|
|
nsresult SetQuery(const nsACString &aQuery) override;
|
|
|
|
nsresult SetRef(const nsACString &aRef) override;
|
2018-03-05 03:14:44 +00:00
|
|
|
bool Deserialize(const mozilla::ipc::URIParams&);
|
2018-03-19 19:22:32 +00:00
|
|
|
nsresult ReadPrivate(nsIObjectInputStream *stream);
|
2017-11-20 16:11:30 +00:00
|
|
|
|
|
|
|
public:
|
2018-02-28 01:13:57 +00:00
|
|
|
class Mutator final
|
2017-11-20 16:11:30 +00:00
|
|
|
: public nsIURIMutator
|
|
|
|
, public BaseURIMutator<nsSimpleNestedURI>
|
2018-03-19 19:22:32 +00:00
|
|
|
, public nsISerializable
|
2018-03-20 22:23:31 +00:00
|
|
|
, public nsINestedURIMutator
|
2017-11-20 16:11:30 +00:00
|
|
|
{
|
|
|
|
NS_DECL_ISUPPORTS
|
2017-12-05 01:35:21 +00:00
|
|
|
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
2017-11-20 16:11:30 +00:00
|
|
|
|
2018-04-30 16:46:04 +00:00
|
|
|
explicit Mutator() = default;
|
2017-11-20 16:11:30 +00:00
|
|
|
private:
|
2018-04-30 16:46:04 +00:00
|
|
|
virtual ~Mutator() = default;
|
2017-11-20 16:11:30 +00:00
|
|
|
|
2018-01-19 14:19:42 +00:00
|
|
|
MOZ_MUST_USE NS_IMETHOD
|
|
|
|
Deserialize(const mozilla::ipc::URIParams& aParams) override
|
|
|
|
{
|
|
|
|
return InitFromIPCParams(aParams);
|
|
|
|
}
|
|
|
|
|
2018-03-19 19:22:32 +00:00
|
|
|
NS_IMETHOD
|
|
|
|
Write(nsIObjectOutputStream *aOutputStream) override
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2018-01-19 14:19:42 +00:00
|
|
|
MOZ_MUST_USE NS_IMETHOD
|
|
|
|
Read(nsIObjectInputStream* aStream) override
|
|
|
|
{
|
|
|
|
return InitFromInputStream(aStream);
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_MUST_USE NS_IMETHOD
|
|
|
|
Finalize(nsIURI** aURI) override
|
|
|
|
{
|
|
|
|
mURI.forget(aURI);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_MUST_USE NS_IMETHOD
|
|
|
|
SetSpec(const nsACString& aSpec, nsIURIMutator** aMutator) override
|
|
|
|
{
|
|
|
|
if (aMutator) {
|
|
|
|
NS_ADDREF(*aMutator = this);
|
|
|
|
}
|
|
|
|
return InitFromSpec(aSpec);
|
|
|
|
}
|
|
|
|
|
2018-03-20 22:23:31 +00:00
|
|
|
MOZ_MUST_USE NS_IMETHOD
|
|
|
|
Init(nsIURI* innerURI) override
|
|
|
|
{
|
|
|
|
mURI = new nsSimpleNestedURI(innerURI);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-11-20 16:11:30 +00:00
|
|
|
friend class nsSimpleNestedURI;
|
|
|
|
};
|
2018-02-26 23:07:48 +00:00
|
|
|
|
|
|
|
friend BaseURIMutator<nsSimpleNestedURI>;
|
2006-06-19 21:02:12 +00:00
|
|
|
};
|
|
|
|
|
2016-05-19 02:02:57 +00:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2006-06-19 21:02:12 +00:00
|
|
|
#endif /* nsSimpleNestedURI_h__ */
|