michael@0: /* ***** BEGIN LICENSE BLOCK ***** michael@0: * Version: Mozilla-sample-code 1.0 michael@0: * michael@0: * Copyright (c) 2002 Netscape Communications Corporation and michael@0: * other contributors michael@0: * michael@0: * Permission is hereby granted, free of charge, to any person obtaining a michael@0: * copy of this Mozilla sample software and associated documentation files michael@0: * (the "Software"), to deal in the Software without restriction, including michael@0: * without limitation the rights to use, copy, modify, merge, publish, michael@0: * distribute, sublicense, and/or sell copies of the Software, and to permit michael@0: * persons to whom the Software is furnished to do so, subject to the michael@0: * following conditions: michael@0: * michael@0: * The above copyright notice and this permission notice shall be included michael@0: * in all copies or substantial portions of the Software. michael@0: * michael@0: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS michael@0: * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, michael@0: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL michael@0: * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER michael@0: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING michael@0: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER michael@0: * DEALINGS IN THE SOFTWARE. michael@0: * michael@0: * Contributor(s): michael@0: * michael@0: * ***** END LICENSE BLOCK ***** */ michael@0: michael@0: #ifndef __WebBrowserChrome__ michael@0: #define __WebBrowserChrome__ michael@0: michael@0: // OS headers michael@0: michael@0: #include michael@0: michael@0: // FROZEN APIs michael@0: michael@0: #include "nsStringAPI.h" michael@0: michael@0: #include "nsIWebBrowserChrome.h" michael@0: #include "nsIWebBrowserChromeFocus.h" michael@0: michael@0: #include "nsIContextMenuListener.h" michael@0: #include "nsIEmbeddingSiteWindow.h" michael@0: #include "nsIInterfaceRequestor.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsISHistoryListener.h" michael@0: #include "nsITooltipListener.h" michael@0: #include "nsIWebProgressListener.h" michael@0: #include "nsIWebBrowser.h" michael@0: michael@0: // GLUE APIs (not frozen, but safe because we're statically linking them) michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIInterfaceRequestorUtils.h" michael@0: #include "nsWeakReference.h" michael@0: michael@0: class WebBrowserChromeUI michael@0: { michael@0: public: michael@0: static HWND CreateNativeWindow(nsIWebBrowserChrome* chrome); michael@0: static void Destroy(nsIWebBrowserChrome* chrome); michael@0: static void Destroyed(nsIWebBrowserChrome* chrome); michael@0: static void SetFocus(nsIWebBrowserChrome *chrome); michael@0: static void UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const char16_t* aStatusText); michael@0: static void UpdateCurrentURI(nsIWebBrowserChrome *aChrome); michael@0: static void UpdateBusyState(nsIWebBrowserChrome *aChrome, bool aBusy); michael@0: static void UpdateProgress(nsIWebBrowserChrome *aChrome, int32_t aCurrent, int32_t aMax); michael@0: static void GetResourceStringById(int32_t aID, char ** aReturn); michael@0: static void ShowContextMenu(nsIWebBrowserChrome *aChrome, uint32_t aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode); michael@0: static void ShowTooltip(nsIWebBrowserChrome *aChrome, int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText); michael@0: static void HideTooltip(nsIWebBrowserChrome *aChrome); michael@0: static void ShowWindow(nsIWebBrowserChrome *aChrome, bool aShow); michael@0: static void SizeTo(nsIWebBrowserChrome *aChrome, int32_t aWidth, int32_t aHeight); michael@0: }; michael@0: michael@0: class WebBrowserChrome : public nsIWebBrowserChrome, michael@0: public nsIWebBrowserChromeFocus, michael@0: public nsIWebProgressListener, michael@0: public nsIEmbeddingSiteWindow, michael@0: public nsIInterfaceRequestor, michael@0: public nsISHistoryListener, michael@0: public nsIObserver, michael@0: public nsIContextMenuListener, michael@0: public nsITooltipListener, michael@0: public nsSupportsWeakReference michael@0: michael@0: { michael@0: public: michael@0: WebBrowserChrome(); michael@0: virtual ~WebBrowserChrome(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIWEBBROWSERCHROME michael@0: NS_DECL_NSIWEBBROWSERCHROMEFOCUS michael@0: NS_DECL_NSIWEBPROGRESSLISTENER michael@0: NS_DECL_NSIEMBEDDINGSITEWINDOW michael@0: NS_DECL_NSIINTERFACEREQUESTOR michael@0: NS_DECL_NSISHISTORYLISTENER michael@0: NS_DECL_NSIOBSERVER michael@0: NS_DECL_NSICONTEXTMENULISTENER michael@0: NS_DECL_NSITOOLTIPLISTENER michael@0: michael@0: nsresult CreateBrowser(int32_t aX, int32_t aY, int32_t aCX, int32_t aCY, michael@0: nsIWebBrowser **aBrowser); michael@0: michael@0: void SetParent(nsIWebBrowserChrome *aParent) michael@0: { mDependentParent = aParent; } michael@0: michael@0: protected: michael@0: nsresult SendHistoryStatusMessage(nsIURI * aURI, char * operation, int32_t info1=0, uint32_t info2=0); michael@0: michael@0: void ContentFinishedLoading(); michael@0: michael@0: HWND mNativeWindow; michael@0: uint32_t mChromeFlags; michael@0: bool mContinueModalLoop; michael@0: bool mSizeSet; michael@0: michael@0: nsCOMPtr mWebBrowser; michael@0: nsCOMPtr mDependentParent; // opener (for dependent windows only) michael@0: }; michael@0: michael@0: #endif /* __WebBrowserChrome__ */