2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-08-02 10:02:29 +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/. */
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
#ifndef nsHostObjectURI_h
|
|
|
|
#define nsHostObjectURI_h
|
2012-08-02 10:02:29 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2016-07-17 17:32:02 +03:00
|
|
|
#include "mozilla/dom/File.h"
|
2012-08-02 10:02:29 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIClassInfo.h"
|
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "nsISerializable.h"
|
2016-07-17 17:32:02 +03:00
|
|
|
#include "nsIURIWithBlobImpl.h"
|
2012-08-02 10:02:29 +04:00
|
|
|
#include "nsIURIWithPrincipal.h"
|
|
|
|
#include "nsSimpleURI.h"
|
2015-03-07 00:33:00 +03:00
|
|
|
#include "nsIIPCSerializableURI.h"
|
2016-10-06 21:28:03 +03:00
|
|
|
#include "nsWeakReference.h"
|
|
|
|
|
2012-08-02 10:02:29 +04:00
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
/**
|
2013-06-21 07:15:15 +04:00
|
|
|
* These URIs refer to host objects: Blobs, with scheme "blob",
|
|
|
|
* MediaStreams, with scheme "mediastream", and MediaSources, with scheme
|
|
|
|
* "mediasource".
|
2012-09-25 07:24:44 +04:00
|
|
|
*/
|
2016-07-17 17:32:02 +03:00
|
|
|
class nsHostObjectURI : public mozilla::net::nsSimpleURI
|
|
|
|
, public nsIURIWithPrincipal
|
|
|
|
, public nsIURIWithBlobImpl
|
2016-10-06 21:28:03 +03:00
|
|
|
, public nsSupportsWeakReference
|
2012-08-02 10:02:29 +04:00
|
|
|
{
|
|
|
|
public:
|
2016-07-17 17:32:02 +03:00
|
|
|
nsHostObjectURI(nsIPrincipal* aPrincipal,
|
|
|
|
mozilla::dom::BlobImpl* aBlobImpl)
|
|
|
|
: mozilla::net::nsSimpleURI()
|
|
|
|
, mPrincipal(aPrincipal)
|
|
|
|
, mBlobImpl(aBlobImpl)
|
2012-08-02 10:02:29 +04:00
|
|
|
{}
|
|
|
|
|
|
|
|
// For use only from deserialization
|
2016-05-19 05:02:57 +03:00
|
|
|
nsHostObjectURI() : mozilla::net::nsSimpleURI() {}
|
2012-08-02 10:02:29 +04:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2016-07-17 17:32:02 +03:00
|
|
|
NS_DECL_NSIURIWITHBLOBIMPL
|
2012-08-02 10:02:29 +04:00
|
|
|
NS_DECL_NSIURIWITHPRINCIPAL
|
|
|
|
NS_DECL_NSISERIALIZABLE
|
|
|
|
NS_DECL_NSICLASSINFO
|
2015-03-07 00:33:00 +03:00
|
|
|
NS_DECL_NSIIPCSERIALIZABLEURI
|
2012-08-02 10:02:29 +04:00
|
|
|
|
2015-12-02 09:06:55 +03:00
|
|
|
NS_IMETHOD SetScheme(const nsACString &aProtocol) override;
|
|
|
|
|
2012-08-02 10:02:29 +04:00
|
|
|
// Override CloneInternal() and EqualsInternal()
|
|
|
|
virtual nsresult CloneInternal(RefHandlingEnum aRefHandlingMode,
|
2016-07-27 01:38:46 +03:00
|
|
|
const nsACString& newRef,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIURI** aClone) override;
|
2012-08-02 10:02:29 +04:00
|
|
|
virtual nsresult EqualsInternal(nsIURI* aOther,
|
|
|
|
RefHandlingEnum aRefHandlingMode,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool* aResult) override;
|
2012-08-02 10:02:29 +04:00
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
// Override StartClone to hand back a nsHostObjectURI
|
2016-07-27 01:38:46 +03:00
|
|
|
virtual mozilla::net::nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode,
|
|
|
|
const nsACString& newRef) override
|
|
|
|
{
|
|
|
|
nsHostObjectURI* url = new nsHostObjectURI();
|
|
|
|
SetRefOnClone(url, refHandlingMode, newRef);
|
|
|
|
return url;
|
|
|
|
}
|
2012-08-02 10:02:29 +04:00
|
|
|
|
2016-10-06 21:28:03 +03:00
|
|
|
void ForgetBlobImpl();
|
|
|
|
|
2012-08-02 10:02:29 +04:00
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
2016-07-17 17:32:02 +03:00
|
|
|
RefPtr<mozilla::dom::BlobImpl> mBlobImpl;
|
2014-07-09 01:23:16 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~nsHostObjectURI() {}
|
2012-08-02 10:02:29 +04:00
|
|
|
};
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
#define NS_HOSTOBJECTURI_CID \
|
2012-08-02 10:02:29 +04:00
|
|
|
{ 0xf5475c51, 0x59a7, 0x4757, \
|
|
|
|
{ 0xb3, 0xd9, 0xe2, 0x11, 0xa9, 0x41, 0x08, 0x72 } }
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
#endif /* nsHostObjectURI_h */
|