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