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-10-27 02:56:59 +04:00
|
|
|
#include "nsCOMPtr.h"
|
1999-11-12 10:28:25 +03:00
|
|
|
#include "nsString.h"
|
|
|
|
#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"
|
|
|
|
|
|
|
|
#include "nsIDocumentLoader.h"
|
|
|
|
#include "nsIDocumentLoaderObserver.h"
|
|
|
|
|
|
|
|
#include "nsIScriptGlobalObject.h"
|
1999-12-03 12:24:22 +03:00
|
|
|
#include "nsIScriptGlobalObjectOwner.h"
|
1999-11-23 13:15:10 +03:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
1999-11-06 07:51:05 +03:00
|
|
|
|
|
|
|
#include "nsDSURIContentListener.h"
|
1999-10-26 05:44:00 +04:00
|
|
|
|
2000-02-17 05:03:02 +03:00
|
|
|
// Interfaces Needed
|
|
|
|
#include "nsISHistory.h"
|
2000-02-14 09:40:28 +03:00
|
|
|
#include "nsIWebNavigation.h"
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
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,
|
1999-12-03 12:24:22 +03:00
|
|
|
public nsIScriptGlobalObjectOwner
|
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:
|
|
|
|
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
|
1999-10-26 05:44:00 +04:00
|
|
|
|
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);
|
|
|
|
|
1999-11-12 10:28:25 +03:00
|
|
|
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* aLoader,
|
1999-11-11 03:34:41 +03:00
|
|
|
nsIChannel* channel,
|
|
|
|
const char *aContentType,
|
|
|
|
const char *aCommand);
|
|
|
|
|
|
|
|
|
1999-11-12 10:28:25 +03:00
|
|
|
static NS_METHOD Create(nsISupports* aOuter, const nsIID& aIID, void** ppv);
|
|
|
|
|
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
|
|
|
nsDocShell();
|
|
|
|
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();
|
|
|
|
NS_IMETHOD CreateAboutBlankContentViewer();
|
1999-12-18 05:23:31 +03:00
|
|
|
NS_IMETHOD CreateContentViewer(const char* aContentType, nsURILoadCommand aCommand,
|
1999-11-12 12:07:28 +03:00
|
|
|
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler);
|
1999-12-18 05:23:31 +03:00
|
|
|
NS_IMETHOD NewContentViewerObj(const char* aContentType, nsURILoadCommand aCommand,
|
1999-11-12 12:07:28 +03:00
|
|
|
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler);
|
2000-02-14 09:40:28 +03:00
|
|
|
NS_IMETHOD SetupNewViewer(nsIContentViewer* aNewViewer);
|
1999-11-07 13:03:51 +03:00
|
|
|
|
2000-02-24 07:15:22 +03:00
|
|
|
// Site Loading
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
loadNormal,
|
|
|
|
loadHistory,
|
|
|
|
loadReloadNormal,
|
|
|
|
loadReloadBypassCache,
|
|
|
|
loadReloadBypassProxy,
|
|
|
|
loadRelaodBypassProxyAndCache,
|
|
|
|
loadLink
|
|
|
|
} loadType;
|
|
|
|
|
|
|
|
NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrer,
|
|
|
|
nsIInputStream* aPostData=nsnull, loadType aLoadType=loadNormal);
|
|
|
|
NS_IMETHOD DoURILoad(nsIURI* aURI);
|
2000-02-17 05:03:02 +03:00
|
|
|
NS_IMETHOD StopCurrentLoads();
|
2000-02-24 07:15:22 +03:00
|
|
|
NS_IMETHOD ScrollIfAnchor(nsIURI* aURI, PRBool* aWasAnchor);
|
|
|
|
NS_IMETHOD OnLoadingSite(nsIURI* aURI);
|
|
|
|
void SetCurrentURI(nsIURI* aURI);
|
|
|
|
void SetReferrerURI(nsIURI* aURI);
|
|
|
|
|
|
|
|
// Session History
|
|
|
|
NS_IMETHOD ShouldAddToSessionHistory(nsIURI* aURI, PRBool* aShouldAdd);
|
|
|
|
NS_IMETHOD AddToSessionHistory(nsIURI* aURI);
|
|
|
|
NS_IMETHOD UpdateCurrentSessionHistory();
|
|
|
|
NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry);
|
|
|
|
|
|
|
|
// Global History
|
|
|
|
NS_IMETHOD ShouldAddToGlobalHistory(nsIURI* aURI, PRBool* aShouldAdd);
|
|
|
|
NS_IMETHOD AddToGlobalHistory(nsIURI* aURI);
|
|
|
|
NS_IMETHOD UpdateCurrentGlobalHistory();
|
|
|
|
|
|
|
|
// Helper Routines
|
|
|
|
nsDocShellInitInfo* InitInfo();
|
|
|
|
NS_IMETHOD GetChildOffset(nsIDOMNode* aChild, nsIDOMNode* aParent,
|
|
|
|
PRInt32* aOffset);
|
|
|
|
NS_IMETHOD GetRootScrollableView(nsIScrollableView** aOutScrollView);
|
|
|
|
NS_IMETHOD EnsureContentListener();
|
|
|
|
NS_IMETHOD EnsureScriptEnvironment();
|
|
|
|
|
2000-02-17 05:03:02 +03:00
|
|
|
|
1999-11-11 03:34:41 +03:00
|
|
|
NS_IMETHOD FireStartDocumentLoad(nsIDocumentLoader* aLoader,
|
|
|
|
nsIURI* aURL,
|
|
|
|
const char* aCommand);
|
|
|
|
|
|
|
|
NS_IMETHOD FireEndDocumentLoad(nsIDocumentLoader* aLoader,
|
|
|
|
nsIChannel* aChannel,
|
1999-12-29 10:32:59 +03:00
|
|
|
nsresult aStatus);
|
1999-11-11 03:34:41 +03:00
|
|
|
|
1999-11-12 02:30:41 +03:00
|
|
|
NS_IMETHOD InsertDocumentInDocTree();
|
1999-11-11 03:34:41 +03:00
|
|
|
|
2000-02-24 07:15:22 +03:00
|
|
|
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;
|
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;
|
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-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-24 07:15:22 +03:00
|
|
|
PRBool mUpdateHistoryOnLoad;
|
|
|
|
PRBool mInitialPageLoad;
|
1999-11-06 07:51:05 +03:00
|
|
|
|
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__ */
|