2002-06-19 18:25:27 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: Mozilla-sample-code 1.0
|
|
|
|
*
|
|
|
|
* Copyright (c) 2002 Netscape Communications Corporation and
|
|
|
|
* other contributors
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this Mozilla sample software and associated documentation files
|
|
|
|
* (the "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
|
|
* persons to whom the Software is furnished to do so, subject to the
|
|
|
|
* following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included
|
|
|
|
* in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
2000-07-05 02:42:09 +04:00
|
|
|
*
|
|
|
|
* Contributor(s):
|
2002-06-19 18:25:27 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2000-07-05 02:42:09 +04:00
|
|
|
|
|
|
|
#ifndef __WebBrowserChrome__
|
|
|
|
#define __WebBrowserChrome__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2000-08-01 05:37:07 +04:00
|
|
|
#include "nsIGenericFactory.h"
|
|
|
|
#include "nsString.h"
|
2000-07-05 02:42:09 +04:00
|
|
|
#include "nsIWebBrowserChrome.h"
|
2001-04-25 06:04:56 +04:00
|
|
|
#include "nsIWebBrowserChromeFocus.h"
|
2000-08-01 05:37:07 +04:00
|
|
|
|
|
|
|
#include "nsIDocShell.h"
|
|
|
|
#include "nsIContentViewer.h"
|
|
|
|
#include "nsIContentViewerFile.h"
|
2000-07-05 02:42:09 +04:00
|
|
|
#include "nsIBaseWindow.h"
|
2001-03-13 15:48:33 +03:00
|
|
|
#include "nsIEmbeddingSiteWindow.h"
|
2000-08-01 05:37:07 +04:00
|
|
|
#include "nsIWebNavigation.h"
|
2000-07-05 02:42:09 +04:00
|
|
|
#include "nsIWebProgressListener.h"
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-06 01:28:38 +04:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
2000-07-05 02:42:09 +04:00
|
|
|
#include "nsIWebBrowser.h"
|
2001-03-22 17:49:39 +03:00
|
|
|
#include "nsIObserver.h"
|
2001-02-01 00:03:40 +03:00
|
|
|
#include "nsWeakReference.h"
|
2001-02-07 03:33:11 +03:00
|
|
|
#include "nsISHistoryListener.h"
|
2001-03-28 15:20:18 +04:00
|
|
|
#include "nsIContextMenuListener.h"
|
|
|
|
#include "nsITooltipListener.h"
|
2000-07-05 02:42:09 +04:00
|
|
|
|
2000-12-13 16:47:16 +03:00
|
|
|
class WebBrowserChromeUI
|
|
|
|
{
|
|
|
|
public:
|
2001-03-22 17:49:39 +03:00
|
|
|
static nativeWindow CreateNativeWindow(nsIWebBrowserChrome* chrome);
|
2001-03-28 15:20:18 +04:00
|
|
|
static void Destroy(nsIWebBrowserChrome* chrome);
|
|
|
|
static void Destroyed(nsIWebBrowserChrome* chrome);
|
2001-09-24 01:03:03 +04:00
|
|
|
static void SetFocus(nsIWebBrowserChrome *chrome);
|
2001-03-22 17:49:39 +03:00
|
|
|
static void UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const PRUnichar* aStatusText);
|
|
|
|
static void UpdateCurrentURI(nsIWebBrowserChrome *aChrome);
|
|
|
|
static void UpdateBusyState(nsIWebBrowserChrome *aChrome, PRBool aBusy);
|
|
|
|
static void UpdateProgress(nsIWebBrowserChrome *aChrome, PRInt32 aCurrent, PRInt32 aMax);
|
|
|
|
static void GetResourceStringById(PRInt32 aID, char ** aReturn);
|
2001-03-28 15:20:18 +04:00
|
|
|
static void ShowContextMenu(nsIWebBrowserChrome *aChrome, PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode);
|
|
|
|
static void ShowTooltip(nsIWebBrowserChrome *aChrome, PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText);
|
|
|
|
static void HideTooltip(nsIWebBrowserChrome *aChrome);
|
2001-04-25 03:05:34 +04:00
|
|
|
static void ShowWindow(nsIWebBrowserChrome *aChrome, PRBool aShow);
|
|
|
|
static void SizeTo(nsIWebBrowserChrome *aChrome, PRInt32 aWidth, PRInt32 aHeight);
|
2000-12-13 16:47:16 +03:00
|
|
|
};
|
2000-07-05 02:42:09 +04:00
|
|
|
|
|
|
|
class WebBrowserChrome : public nsIWebBrowserChrome,
|
2001-04-25 06:04:56 +04:00
|
|
|
public nsIWebBrowserChromeFocus,
|
2000-07-05 02:42:09 +04:00
|
|
|
public nsIWebProgressListener,
|
2001-03-13 15:48:33 +03:00
|
|
|
public nsIEmbeddingSiteWindow,
|
2001-02-01 00:03:40 +03:00
|
|
|
public nsIInterfaceRequestor,
|
2001-02-07 03:33:11 +03:00
|
|
|
public nsISHistoryListener,
|
2001-03-28 15:20:18 +04:00
|
|
|
public nsIObserver,
|
|
|
|
public nsIContextMenuListener,
|
|
|
|
public nsITooltipListener,
|
2001-02-01 00:03:40 +03:00
|
|
|
public nsSupportsWeakReference
|
2001-03-22 17:49:39 +03:00
|
|
|
|
2000-07-05 02:42:09 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
WebBrowserChrome();
|
|
|
|
virtual ~WebBrowserChrome();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIWEBBROWSERCHROME
|
2001-04-25 06:04:56 +04:00
|
|
|
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
|
2000-07-05 02:42:09 +04:00
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
2001-03-13 15:48:33 +03:00
|
|
|
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
2000-07-05 02:42:09 +04:00
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
2001-02-07 03:33:11 +03:00
|
|
|
NS_DECL_NSISHISTORYLISTENER
|
2001-03-22 17:49:39 +03:00
|
|
|
NS_DECL_NSIOBSERVER
|
2001-03-28 15:20:18 +04:00
|
|
|
NS_DECL_NSICONTEXTMENULISTENER
|
|
|
|
NS_DECL_NSITOOLTIPLISTENER
|
2000-07-05 02:42:09 +04:00
|
|
|
|
2001-02-07 08:10:46 +03:00
|
|
|
nsresult CreateBrowser(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY,
|
|
|
|
nsIWebBrowser **aBrowser);
|
2001-04-21 06:45:37 +04:00
|
|
|
|
|
|
|
void SetParent(nsIWebBrowserChrome *aParent)
|
|
|
|
{ mDependentParent = aParent; }
|
2001-02-07 08:10:46 +03:00
|
|
|
|
2000-07-05 02:42:09 +04:00
|
|
|
protected:
|
2001-03-28 15:20:18 +04:00
|
|
|
nsresult SendHistoryStatusMessage(nsIURI * aURI, char * operation, PRInt32 info1=0, PRUint32 info2=0);
|
2001-02-07 08:10:46 +03:00
|
|
|
|
2001-04-25 03:05:34 +04:00
|
|
|
void ContentFinishedLoading();
|
|
|
|
|
2001-03-28 15:20:18 +04:00
|
|
|
nativeWindow mNativeWindow;
|
|
|
|
PRUint32 mChromeFlags;
|
2001-04-21 06:45:37 +04:00
|
|
|
PRBool mContinueModalLoop;
|
2001-04-25 03:05:34 +04:00
|
|
|
PRBool mSizeSet;
|
2001-03-28 15:20:18 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIWebBrowser> mWebBrowser;
|
2001-04-21 06:45:37 +04:00
|
|
|
nsCOMPtr<nsIWebBrowserChrome> mDependentParent; // opener (for dependent windows only)
|
2000-07-05 02:42:09 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __WebBrowserChrome__ */
|