michael@0: /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * 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: // Local Includes michael@0: #include "nsDocShellLoadInfo.h" michael@0: #include "nsISHEntry.h" michael@0: #include "nsIInputStream.h" michael@0: #include "nsIURI.h" michael@0: #include "nsIDocShell.h" michael@0: michael@0: //***************************************************************************** michael@0: //*** nsDocShellLoadInfo: Object Management michael@0: //***************************************************************************** michael@0: michael@0: nsDocShellLoadInfo::nsDocShellLoadInfo() michael@0: : mInheritOwner(false), michael@0: mOwnerIsExplicit(false), michael@0: mSendReferrer(true), michael@0: mLoadType(nsIDocShellLoadInfo::loadNormal), michael@0: mIsSrcdocLoad(false) michael@0: { michael@0: } michael@0: michael@0: nsDocShellLoadInfo::~nsDocShellLoadInfo() michael@0: { michael@0: } michael@0: michael@0: //***************************************************************************** michael@0: // nsDocShellLoadInfo::nsISupports michael@0: //***************************************************************************** michael@0: michael@0: NS_IMPL_ADDREF(nsDocShellLoadInfo) michael@0: NS_IMPL_RELEASE(nsDocShellLoadInfo) michael@0: michael@0: NS_INTERFACE_MAP_BEGIN(nsDocShellLoadInfo) michael@0: NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocShellLoadInfo) michael@0: NS_INTERFACE_MAP_ENTRY(nsIDocShellLoadInfo) michael@0: NS_INTERFACE_MAP_END michael@0: michael@0: //***************************************************************************** michael@0: // nsDocShellLoadInfo::nsIDocShellLoadInfo michael@0: //***************************************************************************** michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetReferrer(nsIURI** aReferrer) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aReferrer); michael@0: michael@0: *aReferrer = mReferrer; michael@0: NS_IF_ADDREF(*aReferrer); michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetReferrer(nsIURI* aReferrer) michael@0: { michael@0: mReferrer = aReferrer; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetOwner(nsISupports** aOwner) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aOwner); michael@0: michael@0: *aOwner = mOwner; michael@0: NS_IF_ADDREF(*aOwner); michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetOwner(nsISupports* aOwner) michael@0: { michael@0: mOwner = aOwner; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetInheritOwner(bool* aInheritOwner) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aInheritOwner); michael@0: michael@0: *aInheritOwner = mInheritOwner; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetInheritOwner(bool aInheritOwner) michael@0: { michael@0: mInheritOwner = aInheritOwner; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetOwnerIsExplicit(bool* aOwnerIsExplicit) michael@0: { michael@0: *aOwnerIsExplicit = mOwnerIsExplicit; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetOwnerIsExplicit(bool aOwnerIsExplicit) michael@0: { michael@0: mOwnerIsExplicit = aOwnerIsExplicit; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetLoadType(nsDocShellInfoLoadType * aLoadType) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aLoadType); michael@0: michael@0: *aLoadType = mLoadType; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetLoadType(nsDocShellInfoLoadType aLoadType) michael@0: { michael@0: mLoadType = aLoadType; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetSHEntry(nsISHEntry** aSHEntry) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aSHEntry); michael@0: michael@0: *aSHEntry = mSHEntry; michael@0: NS_IF_ADDREF(*aSHEntry); michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetSHEntry(nsISHEntry* aSHEntry) michael@0: { michael@0: mSHEntry = aSHEntry; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetTarget(char16_t** aTarget) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aTarget); michael@0: michael@0: *aTarget = ToNewUnicode(mTarget); michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetTarget(const char16_t* aTarget) michael@0: { michael@0: mTarget.Assign(aTarget); michael@0: return NS_OK; michael@0: } michael@0: michael@0: michael@0: NS_IMETHODIMP michael@0: nsDocShellLoadInfo::GetPostDataStream(nsIInputStream **aResult) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aResult); michael@0: michael@0: *aResult = mPostDataStream; michael@0: michael@0: NS_IF_ADDREF(*aResult); michael@0: return NS_OK; michael@0: } michael@0: michael@0: michael@0: NS_IMETHODIMP michael@0: nsDocShellLoadInfo::SetPostDataStream(nsIInputStream *aStream) michael@0: { michael@0: mPostDataStream = aStream; michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* attribute nsIInputStream headersStream; */ michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetHeadersStream(nsIInputStream * *aHeadersStream) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aHeadersStream); michael@0: *aHeadersStream = mHeadersStream; michael@0: NS_IF_ADDREF(*aHeadersStream); michael@0: return NS_OK; michael@0: } michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetHeadersStream(nsIInputStream * aHeadersStream) michael@0: { michael@0: mHeadersStream = aHeadersStream; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetSendReferrer(bool* aSendReferrer) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aSendReferrer); michael@0: michael@0: *aSendReferrer = mSendReferrer; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetSendReferrer(bool aSendReferrer) michael@0: { michael@0: mSendReferrer = aSendReferrer; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetIsSrcdocLoad(bool* aIsSrcdocLoad) michael@0: { michael@0: *aIsSrcdocLoad = mIsSrcdocLoad; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetSrcdocData(nsAString &aSrcdocData) michael@0: { michael@0: aSrcdocData = mSrcdocData; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetSrcdocData(const nsAString &aSrcdocData) michael@0: { michael@0: mSrcdocData = aSrcdocData; michael@0: mIsSrcdocLoad = true; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetSourceDocShell(nsIDocShell** aSourceDocShell) michael@0: { michael@0: MOZ_ASSERT(aSourceDocShell); michael@0: nsCOMPtr result = mSourceDocShell; michael@0: result.forget(aSourceDocShell); michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetSourceDocShell(nsIDocShell* aSourceDocShell) michael@0: { michael@0: mSourceDocShell = aSourceDocShell; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::GetBaseURI(nsIURI** aBaseURI) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aBaseURI); michael@0: michael@0: *aBaseURI = mBaseURI; michael@0: NS_IF_ADDREF(*aBaseURI); michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP nsDocShellLoadInfo::SetBaseURI(nsIURI* aBaseURI) michael@0: { michael@0: mBaseURI = aBaseURI; michael@0: return NS_OK; michael@0: } michael@0: michael@0: //***************************************************************************** michael@0: // nsDocShellLoadInfo: Helpers michael@0: //***************************************************************************** michael@0: michael@0: //***************************************************************************** michael@0: // nsDocShellLoadInfo: Accessors michael@0: //*****************************************************************************