content/base/src/DOMImplementation.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/src/DOMImplementation.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,97 @@
     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 mozilla_dom_DOMImplementation_h
     1.9 +#define mozilla_dom_DOMImplementation_h
    1.10 +
    1.11 +#include "nsIDOMDOMImplementation.h"
    1.12 +#include "nsWrapperCache.h"
    1.13 +
    1.14 +#include "mozilla/Attributes.h"
    1.15 +#include "mozilla/ErrorResult.h"
    1.16 +#include "nsCOMPtr.h"
    1.17 +#include "nsCycleCollectionParticipant.h"
    1.18 +#include "nsIDocument.h"
    1.19 +#include "nsIScriptGlobalObject.h"
    1.20 +#include "nsIURI.h"
    1.21 +#include "nsIWeakReferenceUtils.h"
    1.22 +#include "nsString.h"
    1.23 +
    1.24 +class nsIDOMDocument;
    1.25 +
    1.26 +namespace mozilla {
    1.27 +namespace dom {
    1.28 +class DocumentType;
    1.29 +
    1.30 +class DOMImplementation MOZ_FINAL : public nsIDOMDOMImplementation
    1.31 +                                  , public nsWrapperCache
    1.32 +{
    1.33 +public:
    1.34 +  DOMImplementation(nsIDocument* aOwner,
    1.35 +                    nsIGlobalObject* aScriptObject,
    1.36 +                    nsIURI* aDocumentURI,
    1.37 +                    nsIURI* aBaseURI)
    1.38 +    : mOwner(aOwner)
    1.39 +    , mScriptObject(do_GetWeakReference(aScriptObject))
    1.40 +    , mDocumentURI(aDocumentURI)
    1.41 +    , mBaseURI(aBaseURI)
    1.42 +  {
    1.43 +    MOZ_ASSERT(aOwner);
    1.44 +    SetIsDOMBinding();
    1.45 +  }
    1.46 +
    1.47 +  ~DOMImplementation()
    1.48 +  {
    1.49 +  }
    1.50 +
    1.51 +  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    1.52 +  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMImplementation)
    1.53 +
    1.54 +  nsIDocument* GetParentObject() const
    1.55 +  {
    1.56 +    return mOwner;
    1.57 +  }
    1.58 +
    1.59 +  virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    1.60 +
    1.61 +  // nsIDOMDOMImplementation
    1.62 +  NS_DECL_NSIDOMDOMIMPLEMENTATION
    1.63 +
    1.64 +  bool HasFeature(const nsAString& aFeature, const nsAString& aVersion);
    1.65 +
    1.66 +  already_AddRefed<DocumentType>
    1.67 +  CreateDocumentType(const nsAString& aQualifiedName,
    1.68 +                     const nsAString& aPublicId,
    1.69 +                     const nsAString& aSystemId,
    1.70 +                     ErrorResult& aRv);
    1.71 +
    1.72 +  already_AddRefed<nsIDocument>
    1.73 +  CreateDocument(const nsAString& aNamespaceURI,
    1.74 +                 const nsAString& aQualifiedName,
    1.75 +                 nsIDOMDocumentType* aDoctype,
    1.76 +                 ErrorResult& aRv);
    1.77 +
    1.78 +  already_AddRefed<nsIDocument>
    1.79 +  CreateHTMLDocument(const Optional<nsAString>& aTitle, ErrorResult& aRv);
    1.80 +
    1.81 +private:
    1.82 +  nsresult CreateDocument(const nsAString& aNamespaceURI,
    1.83 +                          const nsAString& aQualifiedName,
    1.84 +                          nsIDOMDocumentType* aDoctype,
    1.85 +                          nsIDocument** aDocument,
    1.86 +                          nsIDOMDocument** aDOMDocument);
    1.87 +  nsresult CreateHTMLDocument(const nsAString& aTitle,
    1.88 +                              nsIDocument** aDocument,
    1.89 +                              nsIDOMDocument** aDOMDocument);
    1.90 +
    1.91 +  nsCOMPtr<nsIDocument> mOwner;
    1.92 +  nsWeakPtr mScriptObject;
    1.93 +  nsCOMPtr<nsIURI> mDocumentURI;
    1.94 +  nsCOMPtr<nsIURI> mBaseURI;
    1.95 +};
    1.96 +
    1.97 +} // namespace dom
    1.98 +} // namespace mozilla
    1.99 +
   1.100 +#endif // mozilla_dom_DOMImplementation_h

mercurial