1 : /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : *
3 : * ***** BEGIN LICENSE BLOCK *****
4 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 : *
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/
10 : *
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
14 : * License.
15 : *
16 : * The Original Code is the Mozilla browser.
17 : *
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.
22 : *
23 : * Contributor(s):
24 : * Travis Bogard <travis@netscape.com>
25 : * Viswanath Ramachandran <vishy@netscape.com>
26 : * Simon Fraser <sfraser@netscape.com>
27 : *
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.
39 : *
40 : * ***** END LICENSE BLOCK ***** */
41 :
42 : // Local Includes
43 : #include "nsDocShellLoadInfo.h"
44 : #include "nsReadableUtils.h"
45 :
46 : //*****************************************************************************
47 : //*** nsDocShellLoadInfo: Object Management
48 : //*****************************************************************************
49 :
50 0 : nsDocShellLoadInfo::nsDocShellLoadInfo()
51 : : mInheritOwner(false),
52 : mOwnerIsExplicit(false),
53 : mSendReferrer(true),
54 0 : mLoadType(nsIDocShellLoadInfo::loadNormal)
55 : {
56 0 : }
57 :
58 0 : nsDocShellLoadInfo::~nsDocShellLoadInfo()
59 : {
60 0 : }
61 :
62 : //*****************************************************************************
63 : // nsDocShellLoadInfo::nsISupports
64 : //*****************************************************************************
65 :
66 0 : NS_IMPL_ADDREF(nsDocShellLoadInfo)
67 0 : NS_IMPL_RELEASE(nsDocShellLoadInfo)
68 :
69 0 : NS_INTERFACE_MAP_BEGIN(nsDocShellLoadInfo)
70 0 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocShellLoadInfo)
71 0 : NS_INTERFACE_MAP_ENTRY(nsIDocShellLoadInfo)
72 0 : NS_INTERFACE_MAP_END
73 :
74 : //*****************************************************************************
75 : // nsDocShellLoadInfo::nsIDocShellLoadInfo
76 : //*****************************************************************************
77 :
78 0 : NS_IMETHODIMP nsDocShellLoadInfo::GetReferrer(nsIURI** aReferrer)
79 : {
80 0 : NS_ENSURE_ARG_POINTER(aReferrer);
81 :
82 0 : *aReferrer = mReferrer;
83 0 : NS_IF_ADDREF(*aReferrer);
84 0 : return NS_OK;
85 : }
86 :
87 0 : NS_IMETHODIMP nsDocShellLoadInfo::SetReferrer(nsIURI* aReferrer)
88 : {
89 0 : mReferrer = aReferrer;
90 0 : return NS_OK;
91 : }
92 :
93 0 : NS_IMETHODIMP nsDocShellLoadInfo::GetOwner(nsISupports** aOwner)
94 : {
95 0 : NS_ENSURE_ARG_POINTER(aOwner);
96 :
97 0 : *aOwner = mOwner;
98 0 : NS_IF_ADDREF(*aOwner);
99 0 : return NS_OK;
100 : }
101 :
102 0 : NS_IMETHODIMP nsDocShellLoadInfo::SetOwner(nsISupports* aOwner)
103 : {
104 0 : mOwner = aOwner;
105 0 : return NS_OK;
106 : }
107 :
108 0 : NS_IMETHODIMP nsDocShellLoadInfo::GetInheritOwner(bool* aInheritOwner)
109 : {
110 0 : NS_ENSURE_ARG_POINTER(aInheritOwner);
111 :
112 0 : *aInheritOwner = mInheritOwner;
113 0 : return NS_OK;
114 : }
115 :
116 0 : NS_IMETHODIMP nsDocShellLoadInfo::SetInheritOwner(bool aInheritOwner)
117 : {
118 0 : mInheritOwner = aInheritOwner;
119 0 : return NS_OK;
120 : }
121 :
122 0 : NS_IMETHODIMP nsDocShellLoadInfo::GetOwnerIsExplicit(bool* aOwnerIsExplicit)
123 : {
124 0 : *aOwnerIsExplicit = mOwnerIsExplicit;
125 0 : return NS_OK;
126 : }
127 :
128 0 : NS_IMETHODIMP nsDocShellLoadInfo::SetOwnerIsExplicit(bool aOwnerIsExplicit)
129 : {
130 0 : mOwnerIsExplicit = aOwnerIsExplicit;
131 0 : return NS_OK;
132 : }
133 :
134 0 : NS_IMETHODIMP nsDocShellLoadInfo::GetLoadType(nsDocShellInfoLoadType * aLoadType)
135 : {
136 0 : NS_ENSURE_ARG_POINTER(aLoadType);
137 :
138 0 : *aLoadType = mLoadType;
139 0 : return NS_OK;
140 : }
141 :
142 0 : NS_IMETHODIMP nsDocShellLoadInfo::SetLoadType(nsDocShellInfoLoadType aLoadType)
143 : {
144 0 : mLoadType = aLoadType;
145 0 : return NS_OK;
146 : }
147 :
148 0 : NS_IMETHODIMP nsDocShellLoadInfo::GetSHEntry(nsISHEntry** aSHEntry)
149 : {
150 0 : NS_ENSURE_ARG_POINTER(aSHEntry);
151 :
152 0 : *aSHEntry = mSHEntry;
153 0 : NS_IF_ADDREF(*aSHEntry);
154 0 : return NS_OK;
155 : }
156 :
157 0 : NS_IMETHODIMP nsDocShellLoadInfo::SetSHEntry(nsISHEntry* aSHEntry)
158 : {
159 0 : mSHEntry = aSHEntry;
160 0 : return NS_OK;
161 : }
162 :
163 0 : NS_IMETHODIMP nsDocShellLoadInfo::GetTarget(PRUnichar** aTarget)
164 : {
165 0 : NS_ENSURE_ARG_POINTER(aTarget);
166 :
167 0 : *aTarget = ToNewUnicode(mTarget);
168 :
169 0 : return NS_OK;
170 : }
171 :
172 0 : NS_IMETHODIMP nsDocShellLoadInfo::SetTarget(const PRUnichar* aTarget)
173 : {
174 0 : mTarget.Assign(aTarget);
175 0 : return NS_OK;
176 : }
177 :
178 :
179 : NS_IMETHODIMP
180 0 : nsDocShellLoadInfo::GetPostDataStream(nsIInputStream **aResult)
181 : {
182 0 : NS_ENSURE_ARG_POINTER(aResult);
183 :
184 0 : *aResult = mPostDataStream;
185 :
186 0 : NS_IF_ADDREF(*aResult);
187 0 : return NS_OK;
188 : }
189 :
190 :
191 : NS_IMETHODIMP
192 0 : nsDocShellLoadInfo::SetPostDataStream(nsIInputStream *aStream)
193 : {
194 0 : mPostDataStream = aStream;
195 0 : return NS_OK;
196 : }
197 :
198 : /* attribute nsIInputStream headersStream; */
199 0 : NS_IMETHODIMP nsDocShellLoadInfo::GetHeadersStream(nsIInputStream * *aHeadersStream)
200 : {
201 0 : NS_ENSURE_ARG_POINTER(aHeadersStream);
202 0 : *aHeadersStream = mHeadersStream;
203 0 : NS_IF_ADDREF(*aHeadersStream);
204 0 : return NS_OK;
205 : }
206 0 : NS_IMETHODIMP nsDocShellLoadInfo::SetHeadersStream(nsIInputStream * aHeadersStream)
207 : {
208 0 : mHeadersStream = aHeadersStream;
209 0 : return NS_OK;
210 : }
211 :
212 0 : NS_IMETHODIMP nsDocShellLoadInfo::GetSendReferrer(bool* aSendReferrer)
213 : {
214 0 : NS_ENSURE_ARG_POINTER(aSendReferrer);
215 :
216 0 : *aSendReferrer = mSendReferrer;
217 0 : return NS_OK;
218 : }
219 :
220 0 : NS_IMETHODIMP nsDocShellLoadInfo::SetSendReferrer(bool aSendReferrer)
221 : {
222 0 : mSendReferrer = aSendReferrer;
223 0 : return NS_OK;
224 : }
225 :
226 : //*****************************************************************************
227 : // nsDocShellLoadInfo: Helpers
228 : //*****************************************************************************
229 :
230 : //*****************************************************************************
231 : // nsDocShellLoadInfo: Accessors
232 : //*****************************************************************************
|