michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 sw=2 et tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsLocation_h__ michael@0: #define nsLocation_h__ michael@0: michael@0: #include "nsIDOMLocation.h" michael@0: #include "nsString.h" michael@0: #include "nsIWeakReferenceUtils.h" michael@0: #include "nsWrapperCache.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "js/TypeDecls.h" michael@0: michael@0: class nsIURI; michael@0: class nsIDocShell; michael@0: class nsIDocShellLoadInfo; michael@0: michael@0: //***************************************************************************** michael@0: // nsLocation: Script "location" object michael@0: //***************************************************************************** michael@0: michael@0: class nsLocation : public nsIDOMLocation michael@0: , public nsWrapperCache michael@0: { michael@0: public: michael@0: nsLocation(nsIDocShell *aDocShell); michael@0: virtual ~nsLocation(); michael@0: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsLocation) michael@0: michael@0: void SetDocShell(nsIDocShell *aDocShell); michael@0: nsIDocShell *GetDocShell(); michael@0: michael@0: // nsIDOMLocation michael@0: NS_DECL_NSIDOMLOCATION michael@0: michael@0: protected: michael@0: // In the case of jar: uris, we sometimes want the place the jar was michael@0: // fetched from as the URI instead of the jar: uri itself. Pass in michael@0: // true for aGetInnermostURI when that's the case. michael@0: nsresult GetURI(nsIURI** aURL, bool aGetInnermostURI = false); michael@0: nsresult GetWritableURI(nsIURI** aURL); michael@0: nsresult SetURI(nsIURI* aURL, bool aReplace = false); michael@0: nsresult SetHrefWithBase(const nsAString& aHref, nsIURI* aBase, michael@0: bool aReplace); michael@0: nsresult SetHrefWithContext(JSContext* cx, const nsAString& aHref, michael@0: bool aReplace); michael@0: michael@0: nsresult GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL); michael@0: nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo); michael@0: bool CallerSubsumes(); michael@0: michael@0: nsString mCachedHash; michael@0: nsWeakPtr mDocShell; michael@0: nsWeakPtr mOuter; michael@0: }; michael@0: michael@0: #endif // nsLocation_h__ michael@0: