embedding/tests/winEmbed/WebBrowserChrome.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* ***** BEGIN LICENSE BLOCK *****
michael@0 2 * Version: Mozilla-sample-code 1.0
michael@0 3 *
michael@0 4 * Copyright (c) 2002 Netscape Communications Corporation and
michael@0 5 * other contributors
michael@0 6 *
michael@0 7 * Permission is hereby granted, free of charge, to any person obtaining a
michael@0 8 * copy of this Mozilla sample software and associated documentation files
michael@0 9 * (the "Software"), to deal in the Software without restriction, including
michael@0 10 * without limitation the rights to use, copy, modify, merge, publish,
michael@0 11 * distribute, sublicense, and/or sell copies of the Software, and to permit
michael@0 12 * persons to whom the Software is furnished to do so, subject to the
michael@0 13 * following conditions:
michael@0 14 *
michael@0 15 * The above copyright notice and this permission notice shall be included
michael@0 16 * in all copies or substantial portions of the Software.
michael@0 17 *
michael@0 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
michael@0 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
michael@0 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
michael@0 21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
michael@0 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
michael@0 23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
michael@0 24 * DEALINGS IN THE SOFTWARE.
michael@0 25 *
michael@0 26 * Contributor(s):
michael@0 27 *
michael@0 28 * ***** END LICENSE BLOCK ***** */
michael@0 29
michael@0 30 #ifndef __WebBrowserChrome__
michael@0 31 #define __WebBrowserChrome__
michael@0 32
michael@0 33 // OS headers
michael@0 34
michael@0 35 #include <windows.h>
michael@0 36
michael@0 37 // FROZEN APIs
michael@0 38
michael@0 39 #include "nsStringAPI.h"
michael@0 40
michael@0 41 #include "nsIWebBrowserChrome.h"
michael@0 42 #include "nsIWebBrowserChromeFocus.h"
michael@0 43
michael@0 44 #include "nsIContextMenuListener.h"
michael@0 45 #include "nsIEmbeddingSiteWindow.h"
michael@0 46 #include "nsIInterfaceRequestor.h"
michael@0 47 #include "nsIObserver.h"
michael@0 48 #include "nsISHistoryListener.h"
michael@0 49 #include "nsITooltipListener.h"
michael@0 50 #include "nsIWebProgressListener.h"
michael@0 51 #include "nsIWebBrowser.h"
michael@0 52
michael@0 53 // GLUE APIs (not frozen, but safe because we're statically linking them)
michael@0 54 #include "nsCOMPtr.h"
michael@0 55 #include "nsIInterfaceRequestorUtils.h"
michael@0 56 #include "nsWeakReference.h"
michael@0 57
michael@0 58 class WebBrowserChromeUI
michael@0 59 {
michael@0 60 public:
michael@0 61 static HWND CreateNativeWindow(nsIWebBrowserChrome* chrome);
michael@0 62 static void Destroy(nsIWebBrowserChrome* chrome);
michael@0 63 static void Destroyed(nsIWebBrowserChrome* chrome);
michael@0 64 static void SetFocus(nsIWebBrowserChrome *chrome);
michael@0 65 static void UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const char16_t* aStatusText);
michael@0 66 static void UpdateCurrentURI(nsIWebBrowserChrome *aChrome);
michael@0 67 static void UpdateBusyState(nsIWebBrowserChrome *aChrome, bool aBusy);
michael@0 68 static void UpdateProgress(nsIWebBrowserChrome *aChrome, int32_t aCurrent, int32_t aMax);
michael@0 69 static void GetResourceStringById(int32_t aID, char ** aReturn);
michael@0 70 static void ShowContextMenu(nsIWebBrowserChrome *aChrome, uint32_t aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode);
michael@0 71 static void ShowTooltip(nsIWebBrowserChrome *aChrome, int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText);
michael@0 72 static void HideTooltip(nsIWebBrowserChrome *aChrome);
michael@0 73 static void ShowWindow(nsIWebBrowserChrome *aChrome, bool aShow);
michael@0 74 static void SizeTo(nsIWebBrowserChrome *aChrome, int32_t aWidth, int32_t aHeight);
michael@0 75 };
michael@0 76
michael@0 77 class WebBrowserChrome : public nsIWebBrowserChrome,
michael@0 78 public nsIWebBrowserChromeFocus,
michael@0 79 public nsIWebProgressListener,
michael@0 80 public nsIEmbeddingSiteWindow,
michael@0 81 public nsIInterfaceRequestor,
michael@0 82 public nsISHistoryListener,
michael@0 83 public nsIObserver,
michael@0 84 public nsIContextMenuListener,
michael@0 85 public nsITooltipListener,
michael@0 86 public nsSupportsWeakReference
michael@0 87
michael@0 88 {
michael@0 89 public:
michael@0 90 WebBrowserChrome();
michael@0 91 virtual ~WebBrowserChrome();
michael@0 92
michael@0 93 NS_DECL_ISUPPORTS
michael@0 94 NS_DECL_NSIWEBBROWSERCHROME
michael@0 95 NS_DECL_NSIWEBBROWSERCHROMEFOCUS
michael@0 96 NS_DECL_NSIWEBPROGRESSLISTENER
michael@0 97 NS_DECL_NSIEMBEDDINGSITEWINDOW
michael@0 98 NS_DECL_NSIINTERFACEREQUESTOR
michael@0 99 NS_DECL_NSISHISTORYLISTENER
michael@0 100 NS_DECL_NSIOBSERVER
michael@0 101 NS_DECL_NSICONTEXTMENULISTENER
michael@0 102 NS_DECL_NSITOOLTIPLISTENER
michael@0 103
michael@0 104 nsresult CreateBrowser(int32_t aX, int32_t aY, int32_t aCX, int32_t aCY,
michael@0 105 nsIWebBrowser **aBrowser);
michael@0 106
michael@0 107 void SetParent(nsIWebBrowserChrome *aParent)
michael@0 108 { mDependentParent = aParent; }
michael@0 109
michael@0 110 protected:
michael@0 111 nsresult SendHistoryStatusMessage(nsIURI * aURI, char * operation, int32_t info1=0, uint32_t info2=0);
michael@0 112
michael@0 113 void ContentFinishedLoading();
michael@0 114
michael@0 115 HWND mNativeWindow;
michael@0 116 uint32_t mChromeFlags;
michael@0 117 bool mContinueModalLoop;
michael@0 118 bool mSizeSet;
michael@0 119
michael@0 120 nsCOMPtr<nsIWebBrowser> mWebBrowser;
michael@0 121 nsCOMPtr<nsIWebBrowserChrome> mDependentParent; // opener (for dependent windows only)
michael@0 122 };
michael@0 123
michael@0 124 #endif /* __WebBrowserChrome__ */

mercurial