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-10-26 22:56:59 +00:00
|
|
|
#include "nsCOMPtr.h"
|
1999-11-12 07:28:25 +00:00
|
|
|
#include "nsString.h"
|
|
|
|
#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-10-26 22:56:59 +00:00
|
|
|
|
1999-11-12 07:28:25 +00:00
|
|
|
#include "nsCDocShell.h"
|
1999-11-11 00:34:41 +00:00
|
|
|
#include "nsIContentViewerContainer.h"
|
|
|
|
|
|
|
|
#include "nsIDocumentLoader.h"
|
|
|
|
#include "nsIDocumentLoaderObserver.h"
|
|
|
|
|
|
|
|
#include "nsIScriptGlobalObject.h"
|
1999-12-03 09:24:22 +00:00
|
|
|
#include "nsIScriptGlobalObjectOwner.h"
|
1999-11-23 10:15:10 +00:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
1999-11-06 04:51:05 +00:00
|
|
|
|
|
|
|
#include "nsDSURIContentListener.h"
|
1999-10-26 01:44:00 +00:00
|
|
|
|
1999-11-11 00:34:41 +00:00
|
|
|
#include "nsVoidArray.h"
|
|
|
|
|
1999-10-26 22:56:59 +00:00
|
|
|
class nsDocShellInitInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//nsIGenericWindow Stuff
|
|
|
|
PRInt32 x;
|
|
|
|
PRInt32 y;
|
|
|
|
PRInt32 cx;
|
|
|
|
PRInt32 cy;
|
|
|
|
PRBool visible;
|
|
|
|
};
|
|
|
|
|
1999-12-03 10:29:08 +00:00
|
|
|
class nsDocShell : public nsIDocShell,
|
|
|
|
public nsIDocShellTreeItem,
|
1999-12-03 09:24:22 +00:00
|
|
|
public nsIDocShellTreeNode,
|
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,
|
1999-12-03 09:24:22 +00:00
|
|
|
public nsIScriptGlobalObjectOwner
|
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:
|
|
|
|
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
|
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
|
1999-10-26 01:44:00 +00:00
|
|
|
|
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);
|
|
|
|
|
1999-11-12 07:28:25 +00:00
|
|
|
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* aLoader,
|
1999-11-11 00:34:41 +00:00
|
|
|
nsIChannel* channel,
|
|
|
|
const char *aContentType,
|
|
|
|
const char *aCommand);
|
|
|
|
|
|
|
|
|
1999-11-12 07:28:25 +00:00
|
|
|
static NS_METHOD Create(nsISupports* aOuter, const nsIID& aIID, void** ppv);
|
|
|
|
|
1999-10-26 01:44:00 +00:00
|
|
|
protected:
|
1999-11-12 07:28:25 +00:00
|
|
|
nsDocShell();
|
|
|
|
virtual ~nsDocShell();
|
1999-10-26 01:44:00 +00:00
|
|
|
|
1999-11-13 08:09:16 +00:00
|
|
|
nsDocShellInitInfo* InitInfo();
|
1999-10-28 02:20:44 +00:00
|
|
|
nsresult GetChildOffset(nsIDOMNode* aChild, nsIDOMNode* aParent,
|
|
|
|
PRInt32* aOffset);
|
|
|
|
nsresult GetRootScrollableView(nsIScrollableView** aOutScrollView);
|
1999-11-06 04:51:05 +00:00
|
|
|
nsresult EnsureContentListener();
|
1999-11-30 01:06:59 +00:00
|
|
|
nsresult EnsureScriptEnvironment();
|
1999-10-28 02:20:44 +00:00
|
|
|
|
1999-11-07 10:03:51 +00:00
|
|
|
void SetCurrentURI(nsIURI* aUri);
|
1999-12-02 07:09:06 +00:00
|
|
|
nsresult CreateContentViewer(const char* aContentType, nsURILoadCommand aCommand,
|
1999-11-12 09:07:28 +00:00
|
|
|
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler);
|
1999-12-02 07:09:06 +00:00
|
|
|
nsresult NewContentViewerObj(const char* aContentType, nsURILoadCommand aCommand,
|
1999-11-12 09:07:28 +00:00
|
|
|
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler);
|
1999-11-07 10:03:51 +00:00
|
|
|
|
1999-11-11 00:34:41 +00:00
|
|
|
NS_IMETHOD FireStartDocumentLoad(nsIDocumentLoader* aLoader,
|
|
|
|
nsIURI* aURL,
|
|
|
|
const char* aCommand);
|
|
|
|
|
|
|
|
NS_IMETHOD FireEndDocumentLoad(nsIDocumentLoader* aLoader,
|
|
|
|
nsIChannel* aChannel,
|
|
|
|
nsresult aStatus,
|
|
|
|
nsIDocumentLoaderObserver * aObserver);
|
|
|
|
|
1999-11-11 23:30:41 +00:00
|
|
|
NS_IMETHOD InsertDocumentInDocTree();
|
1999-11-11 00:34:41 +00:00
|
|
|
NS_IMETHOD DestroyChildren();
|
|
|
|
|
1999-11-12 07:28:25 +00:00
|
|
|
nsresult GetPrimaryFrameFor(nsIContent* content, nsIFrame** frame);
|
|
|
|
|
1999-10-26 01:44:00 +00:00
|
|
|
protected:
|
1999-10-29 18:25:57 +00:00
|
|
|
PRBool mCreated;
|
|
|
|
nsString mName;
|
1999-11-11 00:34:41 +00:00
|
|
|
nsVoidArray mChildren;
|
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;
|
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;
|
1999-11-11 00:34:41 +00:00
|
|
|
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobal;
|
|
|
|
nsCOMPtr<nsIScriptContext> mScriptContext;
|
1999-11-10 21:43:58 +00:00
|
|
|
nsCOMPtr<nsISupports> mLoadCookie;
|
1999-11-19 07:35:27 +00:00
|
|
|
PRInt32 mMarginWidth;
|
|
|
|
PRInt32 mMarginHeight;
|
1999-11-06 04:51:05 +00:00
|
|
|
|
|
|
|
/* Note this can not be nsCOMPtr as that that would cause an addref on the
|
|
|
|
parent thus a cycle. A weak reference would work, but not required as the
|
|
|
|
interface states a requirement to zero out the parent when the parent is
|
|
|
|
releasing the interface.*/
|
1999-12-03 10:29:08 +00:00
|
|
|
nsIDocShellTreeItem* mParent;
|
1999-11-12 07:28:25 +00:00
|
|
|
|
1999-10-26 01:44:00 +00:00
|
|
|
};
|
|
|
|
|
1999-11-12 07:28:25 +00:00
|
|
|
#endif /* nsDocShell_h__ */
|