1999-10-26 01:44:00 +00:00
|
|
|
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is the Mozilla browser.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
|
|
|
* Communications, Inc. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1999, Mozilla. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Travis Bogard <travis@netscape.com>
|
|
|
|
*/
|
|
|
|
|
1999-11-12 07:28:25 +00:00
|
|
|
#ifndef nsDocShell_h__
|
|
|
|
#define nsDocShell_h__
|
1999-10-26 01:44:00 +00:00
|
|
|
|
1999-11-12 07:28:25 +00:00
|
|
|
#include "nsIParser.h" // for nsCharSetSource
|
1999-10-28 02:20:44 +00:00
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsIDOMNode.h"
|
|
|
|
#include "nsIDOMNodeList.h"
|
|
|
|
#include "nsIViewManager.h"
|
|
|
|
#include "nsIScrollableView.h"
|
1999-10-30 02:30:13 +00:00
|
|
|
#include "nsIContentViewer.h"
|
1999-11-06 04:51:05 +00:00
|
|
|
#include "nsIPref.h"
|
1999-12-12 10:15:26 +00:00
|
|
|
#include "nsVoidArray.h"
|
1999-10-26 22:56:59 +00:00
|
|
|
|
1999-11-12 07:28:25 +00:00
|
|
|
#include "nsCDocShell.h"
|
1999-12-12 10:15:26 +00:00
|
|
|
#include "nsIDocShellTreeOwner.h"
|
1999-11-11 00:34:41 +00:00
|
|
|
#include "nsIContentViewerContainer.h"
|
2000-03-08 03:58:33 +00:00
|
|
|
#include "nsIDeviceContext.h"
|
1999-11-11 00:34:41 +00:00
|
|
|
|
|
|
|
#include "nsIDocumentLoader.h"
|
|
|
|
#include "nsIDocumentLoaderObserver.h"
|
|
|
|
|
2000-05-28 09:25:55 +00:00
|
|
|
#include "nsWeakReference.h"
|
2000-03-29 10:29:58 +00:00
|
|
|
|
|
|
|
// Local Includes
|
|
|
|
#include "nsDSURIContentListener.h"
|
|
|
|
|
2000-04-16 08:39:15 +00:00
|
|
|
// Helper Classes
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsPoint.h" // mCurrent/mDefaultScrollbarPreferences
|
|
|
|
#include "nsString.h"
|
|
|
|
|
2000-06-22 05:36:13 +00:00
|
|
|
//#define SH_IN_FRAMES 1
|
|
|
|
|
2000-02-17 02:03:02 +00:00
|
|
|
// Interfaces Needed
|
2000-04-12 00:07:04 +00:00
|
|
|
#include "nsIDocumentCharsetInfo.h"
|
2000-04-16 08:39:15 +00:00
|
|
|
#include "nsIGlobalHistory.h"
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
2000-04-21 23:31:40 +00:00
|
|
|
#include "nsIPrompt.h"
|
2000-04-13 03:11:44 +00:00
|
|
|
#include "nsIRefreshURI.h"
|
2000-04-16 08:39:15 +00:00
|
|
|
#include "nsIScriptGlobalObject.h"
|
|
|
|
#include "nsIScriptGlobalObjectOwner.h"
|
2000-02-17 02:03:02 +00:00
|
|
|
#include "nsISHistory.h"
|
2000-04-13 03:11:44 +00:00
|
|
|
#include "nsIStringBundle.h"
|
2000-04-16 08:39:15 +00:00
|
|
|
#include "nsISupportsArray.h"
|
2000-04-13 03:11:44 +00:00
|
|
|
#include "nsITimerCallback.h"
|
2000-02-14 06:40:28 +00:00
|
|
|
#include "nsIWebNavigation.h"
|
2000-03-26 04:52:06 +00:00
|
|
|
#include "nsIWebProgressListener.h"
|
2000-06-21 06:40:08 +00:00
|
|
|
#include "nsISHContainer.h"
|
2000-02-14 06:40:28 +00:00
|
|
|
|
2000-04-13 03:11:44 +00:00
|
|
|
//*****************************************************************************
|
|
|
|
//*** nsRefreshTimer
|
|
|
|
//*****************************************************************************
|
|
|
|
|
|
|
|
class nsRefreshTimer : public nsITimerCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsRefreshTimer();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsITimerCallback interface
|
|
|
|
NS_IMETHOD_(void) Notify(nsITimer *timer);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDocShell> mDocShell;
|
|
|
|
nsCOMPtr<nsIURI> mURI;
|
|
|
|
PRBool mRepeat;
|
|
|
|
PRInt32 mDelay;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~nsRefreshTimer();
|
|
|
|
};
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
|
|
//*** nsDocShellInitInfo
|
|
|
|
//*****************************************************************************
|
1999-11-11 00:34:41 +00:00
|
|
|
|
1999-10-26 22:56:59 +00:00
|
|
|
class nsDocShellInitInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//nsIGenericWindow Stuff
|
|
|
|
PRInt32 x;
|
|
|
|
PRInt32 y;
|
|
|
|
PRInt32 cx;
|
|
|
|
PRInt32 cy;
|
|
|
|
};
|
|
|
|
|
2000-04-13 03:11:44 +00:00
|
|
|
//*****************************************************************************
|
|
|
|
//*** nsDocShell
|
|
|
|
//*****************************************************************************
|
|
|
|
|
1999-12-03 10:29:08 +00:00
|
|
|
class nsDocShell : public nsIDocShell,
|
|
|
|
public nsIDocShellTreeItem,
|
1999-12-03 09:24:22 +00:00
|
|
|
public nsIDocShellTreeNode,
|
2000-02-14 06:40:28 +00:00
|
|
|
public nsIWebNavigation,
|
1999-11-19 07:35:27 +00:00
|
|
|
public nsIBaseWindow,
|
|
|
|
public nsIScrollable,
|
|
|
|
public nsITextScroll,
|
1999-11-23 10:15:10 +00:00
|
|
|
public nsIContentViewerContainer,
|
1999-11-30 01:06:59 +00:00
|
|
|
public nsIInterfaceRequestor,
|
2000-04-13 03:11:44 +00:00
|
|
|
public nsIScriptGlobalObjectOwner,
|
2000-05-28 09:25:55 +00:00
|
|
|
public nsIRefreshURI,
|
2000-06-20 07:59:45 +00:00
|
|
|
public nsIWebProgressListener,
|
2000-05-28 09:25:55 +00:00
|
|
|
public nsSupportsWeakReference
|
1999-10-26 01:44:00 +00:00
|
|
|
{
|
1999-11-07 10:03:51 +00:00
|
|
|
friend class nsDSURIContentListener;
|
|
|
|
|
1999-10-26 01:44:00 +00:00
|
|
|
public:
|
2000-04-21 23:31:40 +00:00
|
|
|
// Object Management
|
|
|
|
nsDocShell();
|
|
|
|
|
1999-10-26 01:44:00 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
NS_DECL_NSIDOCSHELL
|
1999-12-03 10:29:08 +00:00
|
|
|
NS_DECL_NSIDOCSHELLTREEITEM
|
1999-12-03 09:24:22 +00:00
|
|
|
NS_DECL_NSIDOCSHELLTREENODE
|
2000-02-14 06:40:28 +00:00
|
|
|
NS_DECL_NSIWEBNAVIGATION
|
1999-11-17 08:45:28 +00:00
|
|
|
NS_DECL_NSIBASEWINDOW
|
1999-10-26 01:44:00 +00:00
|
|
|
NS_DECL_NSISCROLLABLE
|
|
|
|
NS_DECL_NSITEXTSCROLL
|
1999-11-18 07:36:41 +00:00
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
1999-12-03 09:24:22 +00:00
|
|
|
NS_DECL_NSISCRIPTGLOBALOBJECTOWNER
|
2000-06-20 07:59:45 +00:00
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
1999-10-26 01:44:00 +00:00
|
|
|
|
2000-04-13 03:11:44 +00:00
|
|
|
// nsIRefreshURI
|
|
|
|
NS_IMETHOD RefreshURI(nsIURI *aURI, PRInt32 aDelay, PRBool aRepeat);
|
|
|
|
NS_IMETHOD CancelRefreshURITimers();
|
|
|
|
|
1999-11-11 00:34:41 +00:00
|
|
|
// XXX: move to a macro
|
|
|
|
// nsIContentViewerContainer
|
1999-11-12 07:28:25 +00:00
|
|
|
NS_IMETHOD Embed(nsIContentViewer* aDocViewer,
|
1999-11-11 00:34:41 +00:00
|
|
|
const char* aCommand,
|
|
|
|
nsISupports* aExtraInfo);
|
|
|
|
|
|
|
|
|
2000-06-20 07:59:45 +00:00
|
|
|
nsresult SetLoadCookie(nsISupports *aCookie);
|
|
|
|
nsresult GetLoadCookie(nsISupports **aResult);
|
|
|
|
|
1999-10-26 01:44:00 +00:00
|
|
|
protected:
|
2000-02-24 04:15:22 +00:00
|
|
|
// Object Management
|
1999-11-12 07:28:25 +00:00
|
|
|
virtual ~nsDocShell();
|
2000-02-24 04:15:22 +00:00
|
|
|
NS_IMETHOD DestroyChildren();
|
1999-10-26 01:44:00 +00:00
|
|
|
|
2000-02-24 04:15:22 +00:00
|
|
|
// Content Viewer Management
|
2000-02-14 06:40:28 +00:00
|
|
|
NS_IMETHOD EnsureContentViewer();
|
2000-03-08 03:58:33 +00:00
|
|
|
NS_IMETHOD EnsureDeviceContext();
|
2000-02-14 06:40:28 +00:00
|
|
|
NS_IMETHOD CreateAboutBlankContentViewer();
|
2000-02-29 22:32:24 +00:00
|
|
|
NS_IMETHOD CreateContentViewer(const char* aContentType,
|
2000-04-04 00:04:04 +00:00
|
|
|
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler);
|
2000-02-29 22:32:24 +00:00
|
|
|
NS_IMETHOD NewContentViewerObj(const char* aContentType,
|
2000-04-04 00:04:04 +00:00
|
|
|
nsIChannel* aOpenedChannel, nsILoadGroup* aLoadGroup,
|
|
|
|
nsIStreamListener** aContentHandler, nsIContentViewer** aViewer);
|
2000-02-14 06:40:28 +00:00
|
|
|
NS_IMETHOD SetupNewViewer(nsIContentViewer* aNewViewer);
|
1999-11-07 10:03:51 +00:00
|
|
|
|
2000-02-24 04:15:22 +00:00
|
|
|
// Site Loading
|
|
|
|
typedef enum
|
|
|
|
{
|
2000-03-30 22:38:32 +00:00
|
|
|
loadNormal, // Normal Load
|
|
|
|
loadNormalReplace, // Normal Load but replaces current history slot
|
|
|
|
loadHistory, // Load from history
|
|
|
|
loadReloadNormal, // Reload
|
2000-02-24 04:15:22 +00:00
|
|
|
loadReloadBypassCache,
|
|
|
|
loadReloadBypassProxy,
|
2000-05-10 22:45:24 +00:00
|
|
|
loadReloadBypassProxyAndCache,
|
2000-06-02 21:02:31 +00:00
|
|
|
loadLink,
|
|
|
|
loadRefresh
|
2000-02-24 04:15:22 +00:00
|
|
|
} loadType;
|
2000-06-22 05:36:13 +00:00
|
|
|
#ifdef SH_IN_FRAMES
|
|
|
|
NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrerURI,
|
|
|
|
nsISupports* owner, const char* aWindowTarget=nsnull,
|
|
|
|
nsIInputStream* aPostData=nsnull, loadType aLoadType=loadNormal, nsISHEntry * aSHEntry = nsnull);
|
|
|
|
#else
|
2000-06-13 23:56:30 +00:00
|
|
|
NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrerURI,
|
|
|
|
nsISupports* owner, const char* aWindowTarget=nsnull,
|
|
|
|
nsIInputStream* aPostData=nsnull, loadType aLoadType=loadNormal);
|
2000-06-22 05:36:13 +00:00
|
|
|
#endif
|
2000-04-04 00:04:04 +00:00
|
|
|
NS_IMETHOD CreateFixupURI(const PRUnichar* aStringURI, nsIURI** aURI);
|
2000-04-11 23:52:42 +00:00
|
|
|
NS_IMETHOD FileURIFixup(const PRUnichar* aStringURI, nsIURI** aURI);
|
|
|
|
NS_IMETHOD ConvertFileToStringURI(nsString& aIn, nsString& aOut);
|
|
|
|
NS_IMETHOD ConvertStringURIToFileCharset(nsString& aIn, nsCString& aOut);
|
|
|
|
NS_IMETHOD KeywordURIFixup(const PRUnichar* aStringURI, nsIURI** aURI);
|
2000-06-13 23:56:30 +00:00
|
|
|
NS_IMETHOD GetCurrentDocumentOwner(nsISupports** aOwner);
|
|
|
|
NS_IMETHOD DoURILoad(nsIURI* aURI, nsIURI* aReferrer, nsISupports *aOwner,
|
2000-04-11 23:52:42 +00:00
|
|
|
nsURILoadCommand aLoadCmd, const char* aWindowTarget,
|
|
|
|
nsIInputStream* aPostData);
|
2000-02-24 04:15:22 +00:00
|
|
|
NS_IMETHOD ScrollIfAnchor(nsIURI* aURI, PRBool* aWasAnchor);
|
2000-03-30 02:24:17 +00:00
|
|
|
NS_IMETHOD OnLoadingSite(nsIChannel* aChannel);
|
2000-06-22 05:36:13 +00:00
|
|
|
NS_IMETHOD OnNewURI(nsIURI *aURI, nsIChannel* aChannel, loadType aLoadType);
|
2000-03-03 22:55:40 +00:00
|
|
|
virtual void SetCurrentURI(nsIURI* aURI);
|
|
|
|
virtual void SetReferrerURI(nsIURI* aURI);
|
2000-02-24 04:15:22 +00:00
|
|
|
|
|
|
|
// Session History
|
|
|
|
NS_IMETHOD ShouldAddToSessionHistory(nsIURI* aURI, PRBool* aShouldAdd);
|
2000-03-25 03:43:27 +00:00
|
|
|
NS_IMETHOD ShouldPersistInSessionHistory(nsIURI* aURI, PRBool* aShouldPersist);
|
2000-05-23 00:51:37 +00:00
|
|
|
NS_IMETHOD AddToSessionHistory(nsIURI* aURI, nsIChannel *aChannel);
|
2000-02-24 04:15:22 +00:00
|
|
|
NS_IMETHOD UpdateCurrentSessionHistory();
|
|
|
|
NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry);
|
2000-06-22 05:36:13 +00:00
|
|
|
// NS_IMETHOD GetCurrentSHE(PRInt32 aChildOffset, nsISHEntry ** aResult);
|
2000-06-21 06:40:08 +00:00
|
|
|
NS_IMETHOD PersistLayoutHistoryState();
|
|
|
|
NS_IMETHOD CloneAndReplace(nsISHEntry * srcEntry, nsISHEntry * aCloneRef,
|
|
|
|
nsISHEntry * areplaceEntry, nsISHEntry * destEntry);
|
2000-02-24 04:15:22 +00:00
|
|
|
// Global History
|
|
|
|
NS_IMETHOD ShouldAddToGlobalHistory(nsIURI* aURI, PRBool* aShouldAdd);
|
|
|
|
NS_IMETHOD AddToGlobalHistory(nsIURI* aURI);
|
|
|
|
NS_IMETHOD UpdateCurrentGlobalHistory();
|
|
|
|
|
|
|
|
// Helper Routines
|
|
|
|
nsDocShellInitInfo* InitInfo();
|
2000-04-21 23:31:40 +00:00
|
|
|
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt** aPrompt, nsIStringBundle**
|
|
|
|
aStringBundle);
|
2000-02-24 04:15:22 +00:00
|
|
|
NS_IMETHOD GetChildOffset(nsIDOMNode* aChild, nsIDOMNode* aParent,
|
|
|
|
PRInt32* aOffset);
|
|
|
|
NS_IMETHOD GetRootScrollableView(nsIScrollableView** aOutScrollView);
|
|
|
|
NS_IMETHOD EnsureContentListener();
|
|
|
|
NS_IMETHOD EnsureScriptEnvironment();
|
|
|
|
|
|
|
|
PRBool IsFrame();
|
1999-11-12 07:28:25 +00:00
|
|
|
|
1999-10-26 01:44:00 +00:00
|
|
|
protected:
|
1999-10-29 18:25:57 +00:00
|
|
|
nsString mName;
|
1999-12-21 00:11:33 +00:00
|
|
|
nsString mTitle;
|
1999-11-11 00:34:41 +00:00
|
|
|
nsVoidArray mChildren;
|
2000-05-17 20:24:43 +00:00
|
|
|
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
1999-11-06 04:51:05 +00:00
|
|
|
nsDSURIContentListener* mContentListener;
|
1999-11-13 08:09:16 +00:00
|
|
|
nsDocShellInitInfo* mInitInfo;
|
1999-10-30 02:30:13 +00:00
|
|
|
nsCOMPtr<nsIContentViewer> mContentViewer;
|
2000-04-12 00:07:04 +00:00
|
|
|
nsCOMPtr<nsIDocumentCharsetInfo> mDocumentCharsetInfo;
|
2000-03-08 03:58:33 +00:00
|
|
|
nsCOMPtr<nsIDeviceContext> mDeviceContext;
|
1999-11-11 00:34:41 +00:00
|
|
|
nsCOMPtr<nsIDocumentLoader>mDocLoader;
|
|
|
|
nsCOMPtr<nsIDocumentLoaderObserver> mDocLoaderObserver;
|
1999-10-29 18:25:57 +00:00
|
|
|
nsCOMPtr<nsIWidget> mParentWidget;
|
|
|
|
nsCOMPtr<nsIPref> mPrefs;
|
1999-11-07 10:03:51 +00:00
|
|
|
nsCOMPtr<nsIURI> mCurrentURI;
|
2000-02-24 04:15:22 +00:00
|
|
|
nsCOMPtr<nsIURI> mReferrerURI;
|
1999-11-11 00:34:41 +00:00
|
|
|
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobal;
|
|
|
|
nsCOMPtr<nsIScriptContext> mScriptContext;
|
2000-02-17 02:03:02 +00:00
|
|
|
nsCOMPtr<nsISHistory> mSessionHistory;
|
2000-04-16 08:39:15 +00:00
|
|
|
nsCOMPtr<nsIGlobalHistory> mGlobalHistory;
|
2000-02-24 04:15:22 +00:00
|
|
|
nsCOMPtr<nsISupports> mLoadCookie; // the load cookie associated with the window context.
|
1999-11-19 07:35:27 +00:00
|
|
|
PRInt32 mMarginWidth;
|
|
|
|
PRInt32 mMarginHeight;
|
1999-12-08 04:57:23 +00:00
|
|
|
PRInt32 mItemType;
|
2000-02-29 06:51:48 +00:00
|
|
|
nsPoint mCurrentScrollbarPref; // this document only
|
|
|
|
nsPoint mDefaultScrollbarPref; // persistent across doc loads
|
2000-03-30 22:38:32 +00:00
|
|
|
loadType mLoadType;
|
2000-02-24 04:15:22 +00:00
|
|
|
PRBool mInitialPageLoad;
|
2000-03-11 00:55:00 +00:00
|
|
|
PRBool mAllowPlugins;
|
2000-03-14 04:36:55 +00:00
|
|
|
PRInt32 mViewMode;
|
2000-06-21 06:40:08 +00:00
|
|
|
|
|
|
|
PRInt32 mOffset; // Offset in the parent's child list.
|
|
|
|
// Reference to the SHEntry for this docshell until the page is destroyed.
|
|
|
|
// Somebody give me better name
|
|
|
|
nsCOMPtr<nsISHEntry> OSHE;
|
|
|
|
// Reference to the SHEntry for this docshell until the page is loaded
|
|
|
|
// Somebody give me better name
|
|
|
|
nsCOMPtr<nsISHEntry> LSHE;
|
2000-03-07 06:02:04 +00:00
|
|
|
// this flag is for bug #21358. a docshell may load many urls
|
|
|
|
// which don't result in new documents being created (i.e. a new content viewer)
|
|
|
|
// we want to make sure we don't call a on load event more than once for a given
|
|
|
|
// content viewer.
|
|
|
|
PRBool mEODForCurrentDocument;
|
1999-11-06 04:51:05 +00:00
|
|
|
|
1999-12-21 00:11:33 +00:00
|
|
|
/* WEAK REFERENCES BELOW HERE.
|
|
|
|
Note these are intentionally not addrefd. Doing so will create a cycle.
|
|
|
|
For that reasons don't use nsCOMPtr.*/
|
1999-12-12 10:15:26 +00:00
|
|
|
nsIDocShellTreeItem* mParent; // Weak Reference
|
|
|
|
nsIDocShellTreeOwner* mTreeOwner; // Weak Reference
|
1999-12-21 00:11:33 +00:00
|
|
|
nsIChromeEventHandler* mChromeEventHandler; //Weak Reference
|
1999-10-26 01:44:00 +00:00
|
|
|
};
|
|
|
|
|
1999-11-12 07:28:25 +00:00
|
|
|
#endif /* nsDocShell_h__ */
|