embedding/tests/winEmbed/WebBrowserChrome.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/embedding/tests/winEmbed/WebBrowserChrome.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,124 @@
     1.4 +/* ***** BEGIN LICENSE BLOCK *****
     1.5 + * Version: Mozilla-sample-code 1.0
     1.6 + *
     1.7 + * Copyright (c) 2002 Netscape Communications Corporation and
     1.8 + * other contributors
     1.9 + *
    1.10 + * Permission is hereby granted, free of charge, to any person obtaining a
    1.11 + * copy of this Mozilla sample software and associated documentation files
    1.12 + * (the "Software"), to deal in the Software without restriction, including
    1.13 + * without limitation the rights to use, copy, modify, merge, publish,
    1.14 + * distribute, sublicense, and/or sell copies of the Software, and to permit
    1.15 + * persons to whom the Software is furnished to do so, subject to the
    1.16 + * following conditions:
    1.17 + *
    1.18 + * The above copyright notice and this permission notice shall be included
    1.19 + * in all copies or substantial portions of the Software.
    1.20 + *
    1.21 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    1.22 + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    1.23 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    1.24 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    1.25 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    1.26 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    1.27 + * DEALINGS IN THE SOFTWARE.
    1.28 + *
    1.29 + * Contributor(s):
    1.30 + *
    1.31 + * ***** END LICENSE BLOCK ***** */
    1.32 +
    1.33 +#ifndef __WebBrowserChrome__
    1.34 +#define __WebBrowserChrome__
    1.35 +
    1.36 +// OS headers
    1.37 +
    1.38 +#include <windows.h>
    1.39 +
    1.40 +// FROZEN APIs
    1.41 +
    1.42 +#include "nsStringAPI.h"
    1.43 +
    1.44 +#include "nsIWebBrowserChrome.h"
    1.45 +#include "nsIWebBrowserChromeFocus.h"
    1.46 +
    1.47 +#include "nsIContextMenuListener.h"
    1.48 +#include "nsIEmbeddingSiteWindow.h"
    1.49 +#include "nsIInterfaceRequestor.h"
    1.50 +#include "nsIObserver.h"
    1.51 +#include "nsISHistoryListener.h"
    1.52 +#include "nsITooltipListener.h"
    1.53 +#include "nsIWebProgressListener.h"
    1.54 +#include "nsIWebBrowser.h"
    1.55 +
    1.56 +// GLUE APIs (not frozen, but safe because we're statically linking them)
    1.57 +#include "nsCOMPtr.h"
    1.58 +#include "nsIInterfaceRequestorUtils.h"
    1.59 +#include "nsWeakReference.h"
    1.60 +
    1.61 +class WebBrowserChromeUI
    1.62 +{
    1.63 +public:
    1.64 +    static HWND CreateNativeWindow(nsIWebBrowserChrome* chrome);
    1.65 +    static void Destroy(nsIWebBrowserChrome* chrome);
    1.66 +    static void Destroyed(nsIWebBrowserChrome* chrome);
    1.67 +    static void SetFocus(nsIWebBrowserChrome *chrome);
    1.68 +    static void UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const char16_t* aStatusText);
    1.69 +    static void UpdateCurrentURI(nsIWebBrowserChrome *aChrome);
    1.70 +    static void UpdateBusyState(nsIWebBrowserChrome *aChrome, bool aBusy);
    1.71 +    static void UpdateProgress(nsIWebBrowserChrome *aChrome, int32_t aCurrent, int32_t aMax);
    1.72 +    static void GetResourceStringById(int32_t aID, char ** aReturn);
    1.73 +    static void ShowContextMenu(nsIWebBrowserChrome *aChrome, uint32_t aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode);
    1.74 +    static void ShowTooltip(nsIWebBrowserChrome *aChrome, int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText);
    1.75 +    static void HideTooltip(nsIWebBrowserChrome *aChrome);
    1.76 +    static void ShowWindow(nsIWebBrowserChrome *aChrome, bool aShow);
    1.77 +    static void SizeTo(nsIWebBrowserChrome *aChrome, int32_t aWidth, int32_t aHeight);
    1.78 +};
    1.79 +
    1.80 +class WebBrowserChrome   : public nsIWebBrowserChrome,
    1.81 +                           public nsIWebBrowserChromeFocus,
    1.82 +                           public nsIWebProgressListener,
    1.83 +                           public nsIEmbeddingSiteWindow,
    1.84 +                           public nsIInterfaceRequestor,
    1.85 +                           public nsISHistoryListener,
    1.86 +                           public nsIObserver,
    1.87 +                           public nsIContextMenuListener,
    1.88 +                           public nsITooltipListener,
    1.89 +                           public nsSupportsWeakReference
    1.90 +
    1.91 +{
    1.92 +public:
    1.93 +    WebBrowserChrome();
    1.94 +    virtual ~WebBrowserChrome();
    1.95 +
    1.96 +    NS_DECL_ISUPPORTS
    1.97 +    NS_DECL_NSIWEBBROWSERCHROME
    1.98 +    NS_DECL_NSIWEBBROWSERCHROMEFOCUS
    1.99 +    NS_DECL_NSIWEBPROGRESSLISTENER
   1.100 +    NS_DECL_NSIEMBEDDINGSITEWINDOW
   1.101 +    NS_DECL_NSIINTERFACEREQUESTOR
   1.102 +    NS_DECL_NSISHISTORYLISTENER
   1.103 +    NS_DECL_NSIOBSERVER
   1.104 +    NS_DECL_NSICONTEXTMENULISTENER
   1.105 +    NS_DECL_NSITOOLTIPLISTENER
   1.106 +
   1.107 +    nsresult CreateBrowser(int32_t aX, int32_t aY, int32_t aCX, int32_t aCY,
   1.108 +                           nsIWebBrowser **aBrowser);
   1.109 +
   1.110 +    void     SetParent(nsIWebBrowserChrome *aParent)
   1.111 +               { mDependentParent = aParent; }
   1.112 +   
   1.113 +protected:
   1.114 +    nsresult SendHistoryStatusMessage(nsIURI * aURI, char * operation, int32_t info1=0, uint32_t info2=0);
   1.115 +
   1.116 +    void ContentFinishedLoading();
   1.117 +
   1.118 +    HWND         mNativeWindow;
   1.119 +    uint32_t     mChromeFlags;
   1.120 +    bool         mContinueModalLoop;
   1.121 +    bool         mSizeSet;
   1.122 +
   1.123 +    nsCOMPtr<nsIWebBrowser> mWebBrowser;
   1.124 +    nsCOMPtr<nsIWebBrowserChrome> mDependentParent; // opener (for dependent windows only)
   1.125 +};
   1.126 +
   1.127 +#endif /* __WebBrowserChrome__ */

mercurial