Back to index

lightning-sunbird  0.9+nobinonly
nsDocShellLoadInfo.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is the Mozilla browser.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications, Inc.
00020  * Portions created by the Initial Developer are Copyright (C) 1999
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Travis Bogard <travis@netscape.com>
00025  *   Viswanath Ramachandran <vishy@netscape.com>
00026  *   Simon Fraser <sfraser@netscape.com>
00027  *
00028  * Alternatively, the contents of this file may be used under the terms of
00029  * either of the GNU General Public License Version 2 or later (the "GPL"),
00030  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00031  * in which case the provisions of the GPL or the LGPL are applicable instead
00032  * of those above. If you wish to allow use of your version of this file only
00033  * under the terms of either the GPL or the LGPL, and not to allow others to
00034  * use your version of this file under the terms of the MPL, indicate your
00035  * decision by deleting the provisions above and replace them with the notice
00036  * and other provisions required by the GPL or the LGPL. If you do not delete
00037  * the provisions above, a recipient may use your version of this file under
00038  * the terms of any one of the MPL, the GPL or the LGPL.
00039  *
00040  * ***** END LICENSE BLOCK ***** */
00041 
00042 // Local Includes
00043 #include "nsDocShellLoadInfo.h"
00044 #include "nsReadableUtils.h"
00045 
00046 //*****************************************************************************
00047 //***    nsDocShellLoadInfo: Object Management
00048 //*****************************************************************************
00049 
00050 nsDocShellLoadInfo::nsDocShellLoadInfo()
00051   : mInheritOwner(PR_FALSE),
00052     mSendReferrer(PR_TRUE),
00053     mLoadType(nsIDocShellLoadInfo::loadNormal)
00054 {
00055 }
00056 
00057 nsDocShellLoadInfo::~nsDocShellLoadInfo()
00058 {
00059 }
00060 
00061 //*****************************************************************************
00062 // nsDocShellLoadInfo::nsISupports
00063 //*****************************************************************************   
00064 
00065 NS_IMPL_ADDREF(nsDocShellLoadInfo)
00066 NS_IMPL_RELEASE(nsDocShellLoadInfo)
00067 
00068 NS_INTERFACE_MAP_BEGIN(nsDocShellLoadInfo)
00069    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocShellLoadInfo)
00070    NS_INTERFACE_MAP_ENTRY(nsIDocShellLoadInfo)
00071 NS_INTERFACE_MAP_END     
00072 
00073 //*****************************************************************************
00074 // nsDocShellLoadInfo::nsIDocShellLoadInfo
00075 //*****************************************************************************   
00076 
00077 NS_IMETHODIMP nsDocShellLoadInfo::GetReferrer(nsIURI** aReferrer)
00078 {
00079    NS_ENSURE_ARG_POINTER(aReferrer);
00080 
00081    *aReferrer = mReferrer;
00082    NS_IF_ADDREF(*aReferrer);
00083    return NS_OK;
00084 }
00085 
00086 NS_IMETHODIMP nsDocShellLoadInfo::SetReferrer(nsIURI* aReferrer)
00087 {
00088    mReferrer = aReferrer;
00089    return NS_OK;
00090 }
00091 
00092 NS_IMETHODIMP nsDocShellLoadInfo::GetOwner(nsISupports** aOwner)
00093 {
00094    NS_ENSURE_ARG_POINTER(aOwner);
00095 
00096    *aOwner = mOwner;
00097    NS_IF_ADDREF(*aOwner);
00098    return NS_OK;
00099 }
00100 
00101 NS_IMETHODIMP nsDocShellLoadInfo::SetOwner(nsISupports* aOwner)
00102 {
00103    mOwner = aOwner;
00104    return NS_OK;
00105 }
00106 
00107 NS_IMETHODIMP nsDocShellLoadInfo::GetInheritOwner(PRBool* aInheritOwner)
00108 {
00109    NS_ENSURE_ARG_POINTER(aInheritOwner);
00110 
00111    *aInheritOwner = mInheritOwner;
00112    return NS_OK;
00113 }
00114 
00115 NS_IMETHODIMP nsDocShellLoadInfo::SetInheritOwner(PRBool aInheritOwner)
00116 {
00117    mInheritOwner = aInheritOwner;
00118    return NS_OK;
00119 }
00120 
00121 NS_IMETHODIMP nsDocShellLoadInfo::GetLoadType(nsDocShellInfoLoadType * aLoadType)
00122 {
00123    NS_ENSURE_ARG_POINTER(aLoadType);
00124 
00125    *aLoadType = mLoadType;
00126    return NS_OK;
00127 }
00128 
00129 NS_IMETHODIMP nsDocShellLoadInfo::SetLoadType(nsDocShellInfoLoadType aLoadType)
00130 {
00131    mLoadType = aLoadType;
00132    return NS_OK;
00133 }
00134 
00135 NS_IMETHODIMP nsDocShellLoadInfo::GetSHEntry(nsISHEntry** aSHEntry)
00136 {
00137    NS_ENSURE_ARG_POINTER(aSHEntry);
00138 
00139    *aSHEntry = mSHEntry;
00140    NS_IF_ADDREF(*aSHEntry);
00141    return NS_OK;
00142 }
00143  
00144 NS_IMETHODIMP nsDocShellLoadInfo::SetSHEntry(nsISHEntry* aSHEntry)
00145 {
00146    mSHEntry = aSHEntry;
00147    return NS_OK;
00148 }
00149 
00150 NS_IMETHODIMP nsDocShellLoadInfo::GetTarget(PRUnichar** aTarget)
00151 {
00152    NS_ENSURE_ARG_POINTER(aTarget);
00153 
00154    *aTarget = ToNewUnicode(mTarget);
00155 
00156    return NS_OK;
00157 }
00158 
00159 NS_IMETHODIMP nsDocShellLoadInfo::SetTarget(const PRUnichar* aTarget)
00160 {
00161    mTarget.Assign(aTarget);
00162    return NS_OK;
00163 }
00164 
00165 
00166 NS_IMETHODIMP
00167 nsDocShellLoadInfo::GetPostDataStream(nsIInputStream **aResult)
00168 {
00169   NS_ENSURE_ARG_POINTER(aResult);
00170 
00171   *aResult = mPostDataStream;
00172 
00173   NS_IF_ADDREF(*aResult);
00174   return NS_OK;
00175 }
00176 
00177 
00178 NS_IMETHODIMP
00179 nsDocShellLoadInfo::SetPostDataStream(nsIInputStream *aStream)
00180 {
00181   mPostDataStream = aStream;
00182   return NS_OK;
00183 }
00184 
00185 /* attribute nsIInputStream headersStream; */
00186 NS_IMETHODIMP nsDocShellLoadInfo::GetHeadersStream(nsIInputStream * *aHeadersStream)
00187 {
00188   NS_ENSURE_ARG_POINTER(aHeadersStream);
00189   *aHeadersStream = mHeadersStream;
00190   NS_IF_ADDREF(*aHeadersStream);
00191   return NS_OK;
00192 }
00193 NS_IMETHODIMP nsDocShellLoadInfo::SetHeadersStream(nsIInputStream * aHeadersStream)
00194 {
00195   mHeadersStream = aHeadersStream;
00196   return NS_OK;
00197 }
00198 
00199 NS_IMETHODIMP nsDocShellLoadInfo::GetSendReferrer(PRBool* aSendReferrer)
00200 {
00201    NS_ENSURE_ARG_POINTER(aSendReferrer);
00202 
00203    *aSendReferrer = mSendReferrer;
00204    return NS_OK;
00205 }
00206 
00207 NS_IMETHODIMP nsDocShellLoadInfo::SetSendReferrer(PRBool aSendReferrer)
00208 {
00209    mSendReferrer = aSendReferrer;
00210    return NS_OK;
00211 }
00212 
00213 //*****************************************************************************
00214 // nsDocShellLoadInfo: Helpers
00215 //*****************************************************************************   
00216 
00217 //*****************************************************************************
00218 // nsDocShellLoadInfo: Accessors
00219 //*****************************************************************************