1999-10-26 05:44:00 +04: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 10:28:25 +03:00
|
|
|
#ifndef nsDocShell_h__
|
|
|
|
#define nsDocShell_h__
|
1999-10-26 05:44:00 +04:00
|
|
|
|
1999-11-12 10:28:25 +03:00
|
|
|
#include "nsIParser.h" // for nsCharSetSource
|
1999-10-28 06:20:44 +04:00
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsIDOMNode.h"
|
|
|
|
#include "nsIDOMNodeList.h"
|
|
|
|
#include "nsIViewManager.h"
|
|
|
|
#include "nsIScrollableView.h"
|
1999-10-30 06:30:13 +04:00
|
|
|
#include "nsIContentViewer.h"
|
1999-11-06 07:51:05 +03:00
|
|
|
#include "nsIPref.h"
|
1999-12-12 13:15:26 +03:00
|
|
|
#include "nsVoidArray.h"
|
1999-10-27 02:56:59 +04:00
|
|
|
|
1999-11-12 10:28:25 +03:00
|
|
|
#include "nsCDocShell.h"
|
1999-12-12 13:15:26 +03:00
|
|
|
#include "nsIDocShellTreeOwner.h"
|
1999-11-11 03:34:41 +03:00
|
|
|
#include "nsIContentViewerContainer.h"
|
2000-03-08 06:58:33 +03:00
|
|
|
#include "nsIDeviceContext.h"
|
1999-11-11 03:34:41 +03:00
|
|
|
|
|
|
|
#include "nsIDocumentLoader.h"
|
|
|
|
#include "nsIDocumentLoaderObserver.h"
|
|
|
|
|
2000-05-28 13:25:55 +04:00
|
|
|
#include "nsWeakReference.h"
|
2000-03-29 14:29:58 +04:00
|
|
|
|
|
|
|
// Local Includes
|
|
|
|
#include "nsDSURIContentListener.h"
|
|
|
|
|
2000-04-16 12:39:15 +04:00
|
|
|
// Helper Classes
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsPoint.h" // mCurrent/mDefaultScrollbarPreferences
|
|
|
|
#include "nsString.h"
|
|
|
|
|
2000-06-22 09:36:13 +04:00
|
|
|
//#define SH_IN_FRAMES 1
|
|
|
|
|
2000-02-17 05:03:02 +03:00
|
|
|
// Interfaces Needed
|
2000-04-12 04:07:04 +04:00
|
|
|
#include "nsIDocumentCharsetInfo.h"
|
2000-04-16 12:39:15 +04:00
|
|
|
#include "nsIGlobalHistory.h"
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
2000-04-22 03:31:40 +04:00
|
|
|
#include "nsIPrompt.h"
|
2000-04-13 07:11:44 +04:00
|
|
|
#include "nsIRefreshURI.h"
|
2000-04-16 12:39:15 +04:00
|
|
|
#include "nsIScriptGlobalObject.h"
|
|
|
|
#include "nsIScriptGlobalObjectOwner.h"
|
2000-02-17 05:03:02 +03:00
|
|
|
#include "nsISHistory.h"
|
2000-04-13 07:11:44 +04:00
|
|
|
#include "nsIStringBundle.h"
|
2000-04-16 12:39:15 +04:00
|
|
|
#include "nsISupportsArray.h"
|
2000-04-13 07:11:44 +04:00
|
|
|
#include "nsITimerCallback.h"
|
2000-02-14 09:40:28 +03:00
|
|
|
#include "nsIWebNavigation.h"
|
2000-03-26 08:52:06 +04:00
|
|
|
#include "nsIWebProgressListener.h"
|
2000-06-21 10:40:08 +04:00
|
|
|
#include "nsISHContainer.h"
|
2000-06-22 11:22:23 +04:00
|
|
|
#include "nsIDocShellLoadInfo.h"
|
2000-02-14 09:40:28 +03:00
|
|
|
|
2000-04-13 07:11:44 +04: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 03:34:41 +03:00
|
|
|
|
1999-10-27 02:56:59 +04:00
|
|
|
class nsDocShellInitInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//nsIGenericWindow Stuff
|
|
|
|
PRInt32 x;
|
|
|
|
PRInt32 y;
|
|
|
|
PRInt32 cx;
|
|
|
|
PRInt32 cy;
|
|
|
|
};
|
|
|
|
|
2000-04-13 07:11:44 +04:00
|
|
|
//*****************************************************************************
|
|
|
|
//*** nsDocShell
|
|
|
|
//*****************************************************************************
|
|
|
|
|
1999-12-03 13:29:08 +03:00
|
|
|
class nsDocShell : public nsIDocShell,
|
|
|
|
public nsIDocShellTreeItem,
|
1999-12-03 12:24:22 +03:00
|
|
|
public nsIDocShellTreeNode,
|
2000-02-14 09:40:28 +03:00
|
|
|
public nsIWebNavigation,
|
1999-11-19 10:35:27 +03:00
|
|
|
public nsIBaseWindow,
|
|
|
|
public nsIScrollable,
|
|
|
|
public nsITextScroll,
|
1999-11-23 13:15:10 +03:00
|
|
|
public nsIContentViewerContainer,
|
1999-11-30 04:06:59 +03:00
|
|
|
public nsIInterfaceRequestor,
|
2000-04-13 07:11:44 +04:00
|
|
|
public nsIScriptGlobalObjectOwner,
|
2000-05-28 13:25:55 +04:00
|
|
|
public nsIRefreshURI,
|
2000-06-20 11:59:45 +04:00
|
|
|
public nsIWebProgressListener,
|
2000-05-28 13:25:55 +04:00
|
|
|
public nsSupportsWeakReference
|
1999-10-26 05:44:00 +04:00
|
|
|
{
|
1999-11-07 13:03:51 +03:00
|
|
|
friend class nsDSURIContentListener;
|
|
|
|
|
1999-10-26 05:44:00 +04:00
|
|
|
public:
|
2000-04-22 03:31:40 +04:00
|
|
|
// Object Management
|
|
|
|
nsDocShell();
|
|
|
|
|
1999-10-26 05:44:00 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
NS_DECL_NSIDOCSHELL
|
1999-12-03 13:29:08 +03:00
|
|
|
NS_DECL_NSIDOCSHELLTREEITEM
|
1999-12-03 12:24:22 +03:00
|
|
|
NS_DECL_NSIDOCSHELLTREENODE
|
2000-02-14 09:40:28 +03:00
|
|
|
NS_DECL_NSIWEBNAVIGATION
|
1999-11-17 11:45:28 +03:00
|
|
|
NS_DECL_NSIBASEWINDOW
|
1999-10-26 05:44:00 +04:00
|
|
|
NS_DECL_NSISCROLLABLE
|
|
|
|
NS_DECL_NSITEXTSCROLL
|
1999-11-18 10:36:41 +03:00
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
1999-12-03 12:24:22 +03:00
|
|
|
NS_DECL_NSISCRIPTGLOBALOBJECTOWNER
|
2000-06-20 11:59:45 +04:00
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
1999-10-26 05:44:00 +04:00
|
|
|
|
2000-04-13 07:11:44 +04:00
|
|
|
// nsIRefreshURI
|
|
|
|
NS_IMETHOD RefreshURI(nsIURI *aURI, PRInt32 aDelay, PRBool aRepeat);
|
|
|
|
NS_IMETHOD CancelRefreshURITimers();
|
|
|
|
|
1999-11-11 03:34:41 +03:00
|
|
|
// XXX: move to a macro
|
|
|
|
// nsIContentViewerContainer
|
1999-11-12 10:28:25 +03:00
|
|
|
NS_IMETHOD Embed(nsIContentViewer* aDocViewer,
|
1999-11-11 03:34:41 +03:00
|
|
|
const char* aCommand,
|
|
|
|
nsISupports* aExtraInfo);
|
|
|
|
|
|
|
|
|
2000-06-20 11:59:45 +04:00
|
|
|
nsresult SetLoadCookie(nsISupports *aCookie);
|
|
|
|
nsresult GetLoadCookie(nsISupports **aResult);
|
|
|
|
|
1999-10-26 05:44:00 +04:00
|
|
|
protected:
|
2000-02-24 07:15:22 +03:00
|
|
|
// Object Management
|
1999-11-12 10:28:25 +03:00
|
|
|
virtual ~nsDocShell();
|
2000-02-24 07:15:22 +03:00
|
|
|
NS_IMETHOD DestroyChildren();
|
1999-10-26 05:44:00 +04:00
|
|
|
|
2000-02-24 07:15:22 +03:00
|
|
|
// Content Viewer Management
|
2000-02-14 09:40:28 +03:00
|
|
|
NS_IMETHOD EnsureContentViewer();
|
2000-03-08 06:58:33 +03:00
|
|
|
NS_IMETHOD EnsureDeviceContext();
|
2000-02-14 09:40:28 +03:00
|
|
|
NS_IMETHOD CreateAboutBlankContentViewer();
|
2000-03-01 01:32:24 +03:00
|
|
|
NS_IMETHOD CreateContentViewer(const char* aContentType,
|
2000-04-04 04:04:04 +04:00
|
|
|
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler);
|
2000-03-01 01:32:24 +03:00
|
|
|
NS_IMETHOD NewContentViewerObj(const char* aContentType,
|
2000-04-04 04:04:04 +04:00
|
|
|
nsIChannel* aOpenedChannel, nsILoadGroup* aLoadGroup,
|
|
|
|
nsIStreamListener** aContentHandler, nsIContentViewer** aViewer);
|
2000-02-14 09:40:28 +03:00
|
|
|
NS_IMETHOD SetupNewViewer(nsIContentViewer* aNewViewer);
|
1999-11-07 13:03:51 +03:00
|
|
|
|
2000-06-22 09:36:13 +04:00
|
|
|
#ifdef SH_IN_FRAMES
|
|
|
|
NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrerURI,
|
|
|
|
nsISupports* owner, const char* aWindowTarget=nsnull,
|
2000-06-22 11:22:23 +04:00
|
|
|
nsIInputStream* aPostData=nsnull, nsDocShellInfoLoadType aLoadType=nsIDocShellLoadInfo::loadNormal, nsISHEntry * aSHEntry = nsnull);
|
2000-06-22 09:36:13 +04:00
|
|
|
#else
|
2000-06-14 03:56:30 +04:00
|
|
|
NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrerURI,
|
|
|
|
nsISupports* owner, const char* aWindowTarget=nsnull,
|
2000-06-22 11:22:23 +04:00
|
|
|
nsIInputStream* aPostData=nsnull, nsDocShellInfoLoadType aLoadType=nsIDocShellLoadInfo::loadNormal);
|
2000-06-22 09:36:13 +04:00
|
|
|
#endif
|
2000-06-22 11:22:23 +04:00
|
|
|
|
2000-04-04 04:04:04 +04:00
|
|
|
NS_IMETHOD CreateFixupURI(const PRUnichar* aStringURI, nsIURI** aURI);
|
2000-04-12 03:52:42 +04: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-14 03:56:30 +04:00
|
|
|
NS_IMETHOD GetCurrentDocumentOwner(nsISupports** aOwner);
|
|
|
|
NS_IMETHOD DoURILoad(nsIURI* aURI, nsIURI* aReferrer, nsISupports *aOwner,
|
2000-04-12 03:52:42 +04:00
|
|
|
nsURILoadCommand aLoadCmd, const char* aWindowTarget,
|
|
|
|
nsIInputStream* aPostData);
|
2000-02-24 07:15:22 +03:00
|
|
|
NS_IMETHOD ScrollIfAnchor(nsIURI* aURI, PRBool* aWasAnchor);
|
2000-03-30 06:24:17 +04:00
|
|
|
NS_IMETHOD OnLoadingSite(nsIChannel* aChannel);
|
2000-06-22 11:22:23 +04:00
|
|
|
|
|
|
|
NS_IMETHOD OnNewURI(nsIURI *aURI, nsIChannel* aChannel, nsDocShellInfoLoadType aLoadType);
|
|
|
|
|
2000-03-04 01:55:40 +03:00
|
|
|
virtual void SetCurrentURI(nsIURI* aURI);
|
|
|
|
virtual void SetReferrerURI(nsIURI* aURI);
|
2000-02-24 07:15:22 +03:00
|
|
|
|
|
|
|
// Session History
|
|
|
|
NS_IMETHOD ShouldAddToSessionHistory(nsIURI* aURI, PRBool* aShouldAdd);
|
2000-03-25 06:43:27 +03:00
|
|
|
NS_IMETHOD ShouldPersistInSessionHistory(nsIURI* aURI, PRBool* aShouldPersist);
|
2000-05-23 04:51:37 +04:00
|
|
|
NS_IMETHOD AddToSessionHistory(nsIURI* aURI, nsIChannel *aChannel);
|
2000-02-24 07:15:22 +03:00
|
|
|
NS_IMETHOD UpdateCurrentSessionHistory();
|
2000-06-24 03:54:30 +04:00
|
|
|
#ifdef SH_IN_FRAMES
|
|
|
|
NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry, nsDocShellInfoLoadType aLoadType);
|
|
|
|
#else
|
2000-02-24 07:15:22 +03:00
|
|
|
NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry);
|
2000-06-24 03:54:30 +04:00
|
|
|
#endif
|
2000-06-22 09:36:13 +04:00
|
|
|
// NS_IMETHOD GetCurrentSHE(PRInt32 aChildOffset, nsISHEntry ** aResult);
|
2000-06-21 10:40:08 +04:00
|
|
|
NS_IMETHOD PersistLayoutHistoryState();
|
|
|
|
NS_IMETHOD CloneAndReplace(nsISHEntry * srcEntry, nsISHEntry * aCloneRef,
|
2000-06-30 01:48:18 +04:00
|
|
|
nsISHEntry * areplaceEntry, nsISHEntry **destEntry);
|
2000-02-24 07:15:22 +03:00
|
|
|
// Global History
|
|
|
|
NS_IMETHOD ShouldAddToGlobalHistory(nsIURI* aURI, PRBool* aShouldAdd);
|
|
|
|
NS_IMETHOD AddToGlobalHistory(nsIURI* aURI);
|
|
|
|
NS_IMETHOD UpdateCurrentGlobalHistory();
|
|
|
|
|
|
|
|
// Helper Routines
|
|
|
|
nsDocShellInitInfo* InitInfo();
|
2000-04-22 03:31:40 +04:00
|
|
|
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt** aPrompt, nsIStringBundle**
|
|
|
|
aStringBundle);
|
2000-02-24 07:15:22 +03: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 10:28:25 +03:00
|
|
|
|
1999-10-26 05:44:00 +04:00
|
|
|
protected:
|
1999-10-29 22:25:57 +04:00
|
|
|
nsString mName;
|
1999-12-21 03:11:33 +03:00
|
|
|
nsString mTitle;
|
1999-11-11 03:34:41 +03:00
|
|
|
nsVoidArray mChildren;
|
2000-05-18 00:24:43 +04:00
|
|
|
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
1999-11-06 07:51:05 +03:00
|
|
|
nsDSURIContentListener* mContentListener;
|
1999-11-13 11:09:16 +03:00
|
|
|
nsDocShellInitInfo* mInitInfo;
|
1999-10-30 06:30:13 +04:00
|
|
|
nsCOMPtr<nsIContentViewer> mContentViewer;
|
2000-04-12 04:07:04 +04:00
|
|
|
nsCOMPtr<nsIDocumentCharsetInfo> mDocumentCharsetInfo;
|
2000-03-08 06:58:33 +03:00
|
|
|
nsCOMPtr<nsIDeviceContext> mDeviceContext;
|
1999-11-11 03:34:41 +03:00
|
|
|
nsCOMPtr<nsIDocumentLoader>mDocLoader;
|
|
|
|
nsCOMPtr<nsIDocumentLoaderObserver> mDocLoaderObserver;
|
1999-10-29 22:25:57 +04:00
|
|
|
nsCOMPtr<nsIWidget> mParentWidget;
|
|
|
|
nsCOMPtr<nsIPref> mPrefs;
|
1999-11-07 13:03:51 +03:00
|
|
|
nsCOMPtr<nsIURI> mCurrentURI;
|
2000-02-24 07:15:22 +03:00
|
|
|
nsCOMPtr<nsIURI> mReferrerURI;
|
1999-11-11 03:34:41 +03:00
|
|
|
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobal;
|
|
|
|
nsCOMPtr<nsIScriptContext> mScriptContext;
|
2000-02-17 05:03:02 +03:00
|
|
|
nsCOMPtr<nsISHistory> mSessionHistory;
|
2000-04-16 12:39:15 +04:00
|
|
|
nsCOMPtr<nsIGlobalHistory> mGlobalHistory;
|
2000-02-24 07:15:22 +03:00
|
|
|
nsCOMPtr<nsISupports> mLoadCookie; // the load cookie associated with the window context.
|
1999-11-19 10:35:27 +03:00
|
|
|
PRInt32 mMarginWidth;
|
|
|
|
PRInt32 mMarginHeight;
|
1999-12-08 07:57:23 +03:00
|
|
|
PRInt32 mItemType;
|
2000-02-29 09:51:48 +03:00
|
|
|
nsPoint mCurrentScrollbarPref; // this document only
|
|
|
|
nsPoint mDefaultScrollbarPref; // persistent across doc loads
|
2000-06-22 11:22:23 +04:00
|
|
|
nsDocShellInfoLoadType mLoadType;
|
2000-02-24 07:15:22 +03:00
|
|
|
PRBool mInitialPageLoad;
|
2000-03-11 03:55:00 +03:00
|
|
|
PRBool mAllowPlugins;
|
2000-03-14 07:36:55 +03:00
|
|
|
PRInt32 mViewMode;
|
2000-06-21 10:40:08 +04:00
|
|
|
|
2000-06-24 03:54:30 +04:00
|
|
|
PRInt32 mChildOffset; // Offset in the parent's child list.
|
2000-06-21 10:40:08 +04:00
|
|
|
// 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 09:02:04 +03: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 07:51:05 +03:00
|
|
|
|
2000-06-23 08:44:36 +04:00
|
|
|
// used to keep track of whether user click links should be handle by us
|
|
|
|
// or immediately kicked out to an external application. mscott: eventually
|
|
|
|
// i'm going to try to fold this up into the uriloader where it belongs but i haven't
|
|
|
|
// figured out how to do that yet.
|
|
|
|
PRBool mUseExternalProtocolHandler;
|
|
|
|
|
1999-12-21 03:11:33 +03: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 13:15:26 +03:00
|
|
|
nsIDocShellTreeItem* mParent; // Weak Reference
|
|
|
|
nsIDocShellTreeOwner* mTreeOwner; // Weak Reference
|
1999-12-21 03:11:33 +03:00
|
|
|
nsIChromeEventHandler* mChromeEventHandler; //Weak Reference
|
1999-10-26 05:44:00 +04:00
|
|
|
};
|
|
|
|
|
1999-11-12 10:28:25 +03:00
|
|
|
#endif /* nsDocShell_h__ */
|