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-10-27 02:56:59 +04:00
|
|
|
|
1999-11-12 10:28:25 +03:00
|
|
|
#include "nsCDocShell.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
|
|
|
|
1999-11-11 03:34:41 +03:00
|
|
|
#include "nsVoidArray.h"
|
|
|
|
|
1999-10-27 02:56:59 +04:00
|
|
|
class nsDocShellInitInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//nsIGenericWindow Stuff
|
|
|
|
PRInt32 x;
|
|
|
|
PRInt32 y;
|
|
|
|
PRInt32 cx;
|
|
|
|
PRInt32 cy;
|
|
|
|
PRBool visible;
|
|
|
|
};
|
|
|
|
|
1999-12-03 13:29:08 +03:00
|
|
|
class nsDocShell : public nsIDocShell,
|
|
|
|
public nsIDocShellTreeItem,
|
1999-12-03 12:24:22 +03:00
|
|
|
public nsIDocShellTreeNode,
|
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
|
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:
|
1999-11-12 10:28:25 +03:00
|
|
|
nsDocShell();
|
|
|
|
virtual ~nsDocShell();
|
1999-10-26 05:44:00 +04:00
|
|
|
|
1999-11-13 11:09:16 +03:00
|
|
|
nsDocShellInitInfo* InitInfo();
|
1999-10-28 06:20:44 +04:00
|
|
|
nsresult GetChildOffset(nsIDOMNode* aChild, nsIDOMNode* aParent,
|
|
|
|
PRInt32* aOffset);
|
|
|
|
nsresult GetRootScrollableView(nsIScrollableView** aOutScrollView);
|
1999-11-06 07:51:05 +03:00
|
|
|
nsresult EnsureContentListener();
|
1999-11-30 04:06:59 +03:00
|
|
|
nsresult EnsureScriptEnvironment();
|
1999-10-28 06:20:44 +04:00
|
|
|
|
1999-11-07 13:03:51 +03:00
|
|
|
void SetCurrentURI(nsIURI* aUri);
|
1999-12-02 10:09:06 +03:00
|
|
|
nsresult CreateContentViewer(const char* aContentType, nsURILoadCommand aCommand,
|
1999-11-12 12:07:28 +03:00
|
|
|
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler);
|
1999-12-02 10:09:06 +03:00
|
|
|
nsresult NewContentViewerObj(const char* aContentType, nsURILoadCommand aCommand,
|
1999-11-12 12:07:28 +03:00
|
|
|
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler);
|
1999-11-07 13:03:51 +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,
|
|
|
|
nsresult aStatus,
|
|
|
|
nsIDocumentLoaderObserver * aObserver);
|
|
|
|
|
1999-11-12 02:30:41 +03:00
|
|
|
NS_IMETHOD InsertDocumentInDocTree();
|
1999-11-11 03:34:41 +03:00
|
|
|
NS_IMETHOD DestroyChildren();
|
|
|
|
|
1999-11-12 10:28:25 +03:00
|
|
|
nsresult GetPrimaryFrameFor(nsIContent* content, nsIFrame** frame);
|
|
|
|
|
1999-10-26 05:44:00 +04:00
|
|
|
protected:
|
1999-10-29 22:25:57 +04:00
|
|
|
PRBool mCreated;
|
|
|
|
nsString mName;
|
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;
|
1999-11-11 03:34:41 +03:00
|
|
|
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobal;
|
|
|
|
nsCOMPtr<nsIScriptContext> mScriptContext;
|
1999-11-11 00:43:58 +03:00
|
|
|
nsCOMPtr<nsISupports> mLoadCookie;
|
1999-11-19 10:35:27 +03:00
|
|
|
PRInt32 mMarginWidth;
|
|
|
|
PRInt32 mMarginHeight;
|
1999-12-08 07:57:23 +03:00
|
|
|
PRInt32 mItemType;
|
1999-11-06 07:51:05 +03: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 13:29:08 +03:00
|
|
|
nsIDocShellTreeItem* mParent;
|
1999-11-12 10:28:25 +03:00
|
|
|
|
1999-10-26 05:44:00 +04:00
|
|
|
};
|
|
|
|
|
1999-11-12 10:28:25 +03:00
|
|
|
#endif /* nsDocShell_h__ */
|