1 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is the Mozilla browser.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications, Inc.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
24 * Travis Bogard <travis@netscape.com>
25 * Viswanath Ramachandran <vishy@netscape.com>
26 * Simon Fraser <sfraser@netscape.com>
28 * Alternatively, the contents of this file may be used under the terms of
29 * either of the GNU General Public License Version 2 or later (the "GPL"),
30 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
40 * ***** END LICENSE BLOCK ***** */
43 #include "nsDocShellLoadInfo.h"
44 #include "nsReadableUtils.h"
46 //*****************************************************************************
47 //*** nsDocShellLoadInfo: Object Management
48 //*****************************************************************************
50 nsDocShellLoadInfo::nsDocShellLoadInfo()
51 : mInheritOwner(PR_FALSE
),
52 mSendReferrer(PR_TRUE
),
53 mLoadType(nsIDocShellLoadInfo::loadNormal
)
57 nsDocShellLoadInfo::~nsDocShellLoadInfo()
61 //*****************************************************************************
62 // nsDocShellLoadInfo::nsISupports
63 //*****************************************************************************
65 NS_IMPL_ADDREF(nsDocShellLoadInfo
)
66 NS_IMPL_RELEASE(nsDocShellLoadInfo
)
68 NS_INTERFACE_MAP_BEGIN(nsDocShellLoadInfo
)
69 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports
, nsIDocShellLoadInfo
)
70 NS_INTERFACE_MAP_ENTRY(nsIDocShellLoadInfo
)
73 //*****************************************************************************
74 // nsDocShellLoadInfo::nsIDocShellLoadInfo
75 //*****************************************************************************
77 NS_IMETHODIMP
nsDocShellLoadInfo::GetReferrer(nsIURI
** aReferrer
)
79 NS_ENSURE_ARG_POINTER(aReferrer
);
81 *aReferrer
= mReferrer
;
82 NS_IF_ADDREF(*aReferrer
);
86 NS_IMETHODIMP
nsDocShellLoadInfo::SetReferrer(nsIURI
* aReferrer
)
88 mReferrer
= aReferrer
;
92 NS_IMETHODIMP
nsDocShellLoadInfo::GetOwner(nsISupports
** aOwner
)
94 NS_ENSURE_ARG_POINTER(aOwner
);
97 NS_IF_ADDREF(*aOwner
);
101 NS_IMETHODIMP
nsDocShellLoadInfo::SetOwner(nsISupports
* aOwner
)
107 NS_IMETHODIMP
nsDocShellLoadInfo::GetInheritOwner(PRBool
* aInheritOwner
)
109 NS_ENSURE_ARG_POINTER(aInheritOwner
);
111 *aInheritOwner
= mInheritOwner
;
115 NS_IMETHODIMP
nsDocShellLoadInfo::SetInheritOwner(PRBool aInheritOwner
)
117 mInheritOwner
= aInheritOwner
;
121 NS_IMETHODIMP
nsDocShellLoadInfo::GetLoadType(nsDocShellInfoLoadType
* aLoadType
)
123 NS_ENSURE_ARG_POINTER(aLoadType
);
125 *aLoadType
= mLoadType
;
129 NS_IMETHODIMP
nsDocShellLoadInfo::SetLoadType(nsDocShellInfoLoadType aLoadType
)
131 mLoadType
= aLoadType
;
135 NS_IMETHODIMP
nsDocShellLoadInfo::GetSHEntry(nsISHEntry
** aSHEntry
)
137 NS_ENSURE_ARG_POINTER(aSHEntry
);
139 *aSHEntry
= mSHEntry
;
140 NS_IF_ADDREF(*aSHEntry
);
144 NS_IMETHODIMP
nsDocShellLoadInfo::SetSHEntry(nsISHEntry
* aSHEntry
)
150 NS_IMETHODIMP
nsDocShellLoadInfo::GetTarget(PRUnichar
** aTarget
)
152 NS_ENSURE_ARG_POINTER(aTarget
);
154 *aTarget
= ToNewUnicode(mTarget
);
159 NS_IMETHODIMP
nsDocShellLoadInfo::SetTarget(const PRUnichar
* aTarget
)
161 mTarget
.Assign(aTarget
);
167 nsDocShellLoadInfo::GetPostDataStream(nsIInputStream
**aResult
)
169 NS_ENSURE_ARG_POINTER(aResult
);
171 *aResult
= mPostDataStream
;
173 NS_IF_ADDREF(*aResult
);
179 nsDocShellLoadInfo::SetPostDataStream(nsIInputStream
*aStream
)
181 mPostDataStream
= aStream
;
185 /* attribute nsIInputStream headersStream; */
186 NS_IMETHODIMP
nsDocShellLoadInfo::GetHeadersStream(nsIInputStream
* *aHeadersStream
)
188 NS_ENSURE_ARG_POINTER(aHeadersStream
);
189 *aHeadersStream
= mHeadersStream
;
190 NS_IF_ADDREF(*aHeadersStream
);
193 NS_IMETHODIMP
nsDocShellLoadInfo::SetHeadersStream(nsIInputStream
* aHeadersStream
)
195 mHeadersStream
= aHeadersStream
;
199 NS_IMETHODIMP
nsDocShellLoadInfo::GetSendReferrer(PRBool
* aSendReferrer
)
201 NS_ENSURE_ARG_POINTER(aSendReferrer
);
203 *aSendReferrer
= mSendReferrer
;
207 NS_IMETHODIMP
nsDocShellLoadInfo::SetSendReferrer(PRBool aSendReferrer
)
209 mSendReferrer
= aSendReferrer
;
213 //*****************************************************************************
214 // nsDocShellLoadInfo: Helpers
215 //*****************************************************************************
217 //*****************************************************************************
218 // nsDocShellLoadInfo: Accessors
219 //*****************************************************************************