content/base/src/nsHostObjectURI.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/src/nsHostObjectURI.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef nsHostObjectURI_h
     1.9 +#define nsHostObjectURI_h
    1.10 +
    1.11 +#include "mozilla/Attributes.h"
    1.12 +#include "nsCOMPtr.h"
    1.13 +#include "nsIClassInfo.h"
    1.14 +#include "nsIPrincipal.h"
    1.15 +#include "nsISerializable.h"
    1.16 +#include "nsIURIWithPrincipal.h"
    1.17 +#include "nsSimpleURI.h"
    1.18 +
    1.19 +/**
    1.20 + * These URIs refer to host objects: Blobs, with scheme "blob",
    1.21 + * MediaStreams, with scheme "mediastream", and MediaSources, with scheme
    1.22 + * "mediasource".
    1.23 + */
    1.24 +class nsHostObjectURI : public nsSimpleURI,
    1.25 +                        public nsIURIWithPrincipal
    1.26 +{
    1.27 +public:
    1.28 +  nsHostObjectURI(nsIPrincipal* aPrincipal) :
    1.29 +      nsSimpleURI(), mPrincipal(aPrincipal)
    1.30 +  {}
    1.31 +  virtual ~nsHostObjectURI() {}
    1.32 +
    1.33 +  // For use only from deserialization
    1.34 +  nsHostObjectURI() : nsSimpleURI() {}
    1.35 +
    1.36 +  NS_DECL_ISUPPORTS_INHERITED
    1.37 +  NS_DECL_NSIURIWITHPRINCIPAL
    1.38 +  NS_DECL_NSISERIALIZABLE
    1.39 +  NS_DECL_NSICLASSINFO
    1.40 +
    1.41 +  // Override CloneInternal() and EqualsInternal()
    1.42 +  virtual nsresult CloneInternal(RefHandlingEnum aRefHandlingMode,
    1.43 +                                 nsIURI** aClone) MOZ_OVERRIDE;
    1.44 +  virtual nsresult EqualsInternal(nsIURI* aOther,
    1.45 +                                  RefHandlingEnum aRefHandlingMode,
    1.46 +                                  bool* aResult) MOZ_OVERRIDE;
    1.47 +
    1.48 +  // Override StartClone to hand back a nsHostObjectURI
    1.49 +  virtual nsSimpleURI* StartClone(RefHandlingEnum /* unused */) MOZ_OVERRIDE
    1.50 +  { return new nsHostObjectURI(); }
    1.51 +
    1.52 +  nsCOMPtr<nsIPrincipal> mPrincipal;
    1.53 +};
    1.54 +
    1.55 +#define NS_HOSTOBJECTURI_CID \
    1.56 +{ 0xf5475c51, 0x59a7, 0x4757, \
    1.57 +  { 0xb3, 0xd9, 0xe2, 0x11, 0xa9, 0x41, 0x08, 0x72 } }
    1.58 +
    1.59 +#endif /* nsHostObjectURI_h */

mercurial