2006-06-20 01:02:12 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04: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-20 01:02:12 +04: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 19:21:24 +03:00
|
|
|
* happens.
|
2006-06-20 01:02:12 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsSimpleNestedURI_h__
|
|
|
|
#define nsSimpleNestedURI_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsSimpleURI.h"
|
|
|
|
#include "nsINestedURI.h"
|
2017-11-20 19:11:30 +03:00
|
|
|
#include "nsIURIMutator.h"
|
2006-06-20 01:02:12 +04:00
|
|
|
|
2015-03-07 00:33:00 +03:00
|
|
|
#include "nsIIPCSerializableURI.h"
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2006-06-20 01:02:12 +04:00
|
|
|
class nsSimpleNestedURI : public nsSimpleURI,
|
|
|
|
public nsINestedURI
|
|
|
|
{
|
2014-06-24 20:36:44 +04:00
|
|
|
protected:
|
2018-03-21 01:23:31 +03:00
|
|
|
nsSimpleNestedURI() = default;
|
2018-03-20 17:45:34 +03:00
|
|
|
explicit nsSimpleNestedURI(nsIURI* innerURI);
|
|
|
|
|
2018-03-21 01:23:31 +03:00
|
|
|
~nsSimpleNestedURI() = default;
|
|
|
|
public:
|
2006-06-20 01:02:12 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_NSINESTEDURI
|
|
|
|
|
|
|
|
// Overrides for various methods nsSimpleURI implements follow.
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2011-05-22 05:12:45 +04:00
|
|
|
// nsSimpleURI overrides
|
|
|
|
virtual nsresult EqualsInternal(nsIURI* other,
|
|
|
|
RefHandlingEnum refHandlingMode,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool* result) override;
|
2016-07-27 01:38:46 +03:00
|
|
|
virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode,
|
|
|
|
const nsACString& newRef) override;
|
2017-11-20 19:11:30 +03:00
|
|
|
NS_IMETHOD Mutate(nsIURIMutator * *_retval) override;
|
2006-06-20 01:02:12 +04:00
|
|
|
|
|
|
|
// nsISerializable overrides
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Read(nsIObjectInputStream* aStream) override;
|
|
|
|
NS_IMETHOD Write(nsIObjectOutputStream* aStream) override;
|
2006-06-20 01:02:12 +04:00
|
|
|
|
2015-03-07 00:33:00 +03:00
|
|
|
// nsIIPCSerializableURI overrides
|
|
|
|
NS_DECL_NSIIPCSERIALIZABLEURI
|
|
|
|
|
2006-06-20 01:02:12 +04:00
|
|
|
// Override the nsIClassInfo method GetClassIDNoAlloc to make sure our
|
|
|
|
// nsISerializable impl works right.
|
2017-07-06 15:00:35 +03:00
|
|
|
NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) override;
|
2006-06-20 01:02:12 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIURI> mInnerURI;
|
2017-11-20 19:11:30 +03:00
|
|
|
|
2018-05-12 17:30:07 +03:00
|
|
|
nsresult SetPathQueryRef(const nsACString &aPathQueryRef) override;
|
|
|
|
nsresult SetQuery(const nsACString &aQuery) override;
|
|
|
|
nsresult SetRef(const nsACString &aRef) override;
|
2018-03-05 06:14:44 +03:00
|
|
|
bool Deserialize(const mozilla::ipc::URIParams&);
|
2018-03-19 22:22:32 +03:00
|
|
|
nsresult ReadPrivate(nsIObjectInputStream *stream);
|
2017-11-20 19:11:30 +03:00
|
|
|
|
|
|
|
public:
|
2018-02-28 04:13:57 +03:00
|
|
|
class Mutator final
|
2017-11-20 19:11:30 +03:00
|
|
|
: public nsIURIMutator
|
|
|
|
, public BaseURIMutator<nsSimpleNestedURI>
|
2018-03-19 22:22:32 +03:00
|
|
|
, public nsISerializable
|
2018-03-21 01:23:31 +03:00
|
|
|
, public nsINestedURIMutator
|
2017-11-20 19:11:30 +03:00
|
|
|
{
|
|
|
|
NS_DECL_ISUPPORTS
|
2017-12-05 04:35:21 +03:00
|
|
|
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
2017-11-20 19:11:30 +03:00
|
|
|
|
2018-04-30 19:46:04 +03:00
|
|
|
explicit Mutator() = default;
|
2017-11-20 19:11:30 +03:00
|
|
|
private:
|
2018-04-30 19:46:04 +03:00
|
|
|
virtual ~Mutator() = default;
|
2017-11-20 19:11:30 +03:00
|
|
|
|
2018-01-19 17:19:42 +03:00
|
|
|
MOZ_MUST_USE NS_IMETHOD
|
|
|
|
Deserialize(const mozilla::ipc::URIParams& aParams) override
|
|
|
|
{
|
|
|
|
return InitFromIPCParams(aParams);
|
|
|
|
}
|
|
|
|
|
2018-03-19 22:22:32 +03:00
|
|
|
NS_IMETHOD
|
|
|
|
Write(nsIObjectOutputStream *aOutputStream) override
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2018-01-19 17:19:42 +03: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-21 01:23:31 +03:00
|
|
|
MOZ_MUST_USE NS_IMETHOD
|
|
|
|
Init(nsIURI* innerURI) override
|
|
|
|
{
|
|
|
|
mURI = new nsSimpleNestedURI(innerURI);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-11-20 19:11:30 +03:00
|
|
|
friend class nsSimpleNestedURI;
|
|
|
|
};
|
2018-02-27 02:07:48 +03:00
|
|
|
|
|
|
|
friend BaseURIMutator<nsSimpleNestedURI>;
|
2006-06-20 01:02:12 +04:00
|
|
|
};
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2006-06-20 01:02:12 +04:00
|
|
|
#endif /* nsSimpleNestedURI_h__ */
|