~ubuntu-branches/ubuntu/trusty/xiphos/trusty

« back to all changes in this revision

Viewing changes to src/geckowin/BrowserEmbed.h

  • Committer: Bazaar Package Importer
  • Author(s): Dmitrijs Ledkovs, Jonathan Marsden, Dmitrijs Ledkovs
  • Date: 2010-11-25 21:26:48 UTC
  • mfrom: (2.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20101125212648-mc64wvs0nw3xp7bx
Tags: 3.1.4-1
[ Jonathan Marsden ]
* New upstream release 3.1.4
* Removed debian/patch/* since the one patch was included upstream.
* Bumped Standards-Version to 3.9.1 (no changes required).
* debian/README.Debian: Corrected spelling and reworded for clarity.
* debian/control: Add Jonathan Marsden back into Uploaders.

[ Dmitrijs Ledkovs ]
* Added local options dpkg-source to unapply patches and fail on
  upstream source changes (ignoring false positives).
* Added bzr-builddeb hook to generate source-format before build. If you
  are not using bzr-builddeb, you must run "./debian/rules clean" before
  building.
* patches/xul-2.0.patch: bump UPPER_RANGE to allow running against xul20.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//copyright xiphos; license gpl2
 
2
 
 
3
#ifndef __PCF_MIRO_BROWSER_EMBED_H__
 
4
#define __PCF_MIRO_BROWSER_EMBED_H__
 
5
 
 
6
#include "prtypes.h"
 
7
#include "nsCOMPtr.h"
 
8
#include "nsIWebBrowserChrome.h"
 
9
#include "nsIEmbeddingSiteWindow.h"
 
10
#include "nsIWebBrowser.h"
 
11
#include "nsIInterfaceRequestor.h"
 
12
#include "nsIWebBrowserChromeFocus.h"
 
13
#include "docshell/nsIWebNavigation.h"
 
14
#include "widget/nsIBaseWindow.h"
 
15
#include "uriloader/nsIURIContentListener.h"
 
16
#include "uriloader/nsIWebProgressListener.h"
 
17
#include "xpcom/nsWeakReference.h"
 
18
#include "shistory/nsIHistoryEntry.h"
 
19
#include "shistory/nsISHistory.h"
 
20
#include "EmbedEventListener.h"
 
21
#include "gecko-html.h"
 
22
#include "content/nsPIDOMEventTarget.h"
 
23
#include "nsEmbedString.h"
 
24
#include "fastfind/nsITypeAheadFind.h"
 
25
#include "dom/nsPIDOMWindow.h"
 
26
#include "nsIContextMenuListener.h"
 
27
 
 
28
#include "main/module_dialogs.h"
 
29
 
 
30
typedef void(*focusCallback)(PRBool forward, void* data);
 
31
typedef int(*uriCallback)(char* uri, void* data);
 
32
typedef void(*networkCallback)(PRBool is_start, void* data);
 
33
 
 
34
class EmbedEventListener;
 
35
 
 
36
class BrowserEmbed   : public nsIWebBrowserChrome,
 
37
        public nsIWebBrowserChromeFocus,
 
38
        public nsIEmbeddingSiteWindow,
 
39
        public nsIInterfaceRequestor,
 
40
        public nsIURIContentListener,
 
41
        public nsIWebProgressListener,
 
42
        public nsSupportsWeakReference,
 
43
        public nsIContextMenuListener
 
44
 
 
45
{
 
46
public:
 
47
    BrowserEmbed();
 
48
    virtual ~BrowserEmbed();
 
49
 
 
50
    /*
 
51
     * Methods from the XPCOM interfaces we implement.  These are proiveded
 
52
     * for XULRunner.
 
53
     */
 
54
 
 
55
    NS_DECL_ISUPPORTS
 
56
    NS_DECL_NSIWEBBROWSERCHROME
 
57
    NS_DECL_NSIEMBEDDINGSITEWINDOW
 
58
    NS_DECL_NSIINTERFACEREQUESTOR
 
59
    NS_DECL_NSIWEBBROWSERCHROMEFOCUS
 
60
    NS_DECL_NSIURICONTENTLISTENER
 
61
    NS_DECL_NSIWEBPROGRESSLISTENER
 
62
    NS_DECL_NSICONTEXTMENULISTENER
 
63
 
 
64
    /*
 
65
     * Methods to interact with the MiroBrowserEmbed from Cython.  These are
 
66
     * called by Miro.
 
67
     */
 
68
 
 
69
    // Create a WebBrowser object and place it inside parentWindow.  This must
 
70
    // be called before any other methods.  
 
71
    nsresult init(unsigned long parentWindow, int x, int y, int width, 
 
72
                  int height, GeckoHtml *owner);
 
73
    // Stop the browser from painting to the screen or handling input
 
74
    nsresult disable();
 
75
    // Startup the browser again after a call to disable()
 
76
    nsresult enable();
 
77
    // Load a URI into the browser
 
78
    nsresult loadURI(const char* uri);
 
79
    // Gets the current uri from mWebNavigator
 
80
    nsresult getCurrentURI(char ** uri);
 
81
    // Gets the current title from a long chain of things
 
82
    nsresult getCurrentTitle(wchar_t ** aTitle);
 
83
    // Call when the parent window changes size
 
84
    nsresult resize(int x, int y, int width, int height);
 
85
    // Give the browser keyboard focus
 
86
    nsresult focus();
 
87
    // Browser Navigation buttons.  Their functionality corresponds to the
 
88
    // nsIWebNavigation interface
 
89
    int canGoBack();
 
90
    int canGoForward();
 
91
    void goBack();
 
92
    void goForward();
 
93
    void stop();
 
94
    void reload();
 
95
    // Set the focus callback.  This will be called when the user tabs through
 
96
    // all the elements in the browser and the next Widget should be given
 
97
    // focus.
 
98
    void SetFocusCallback(focusCallback callback, void* data);
 
99
    // Set the URI callback.  This well be called when we are about to load a
 
100
    // new URI.  It should return 0 if the URI shouldn't be loaded.
 
101
    void SetURICallback(uriCallback callback, void* data);
 
102
    // Set the Network callback.  This is called when we start loading a
 
103
    // document and when all network activity for a document is finished
 
104
    // new URI.  It should return 0 if the URI shouldn't be loaded.
 
105
    void SetNetworkCallback(networkCallback callback, void* data);
 
106
    // Destroy the broswer
 
107
    void destroy();
 
108
 
 
109
    char * GetLinkMessage();
 
110
    gint ProcessMouseDblClickEvent(void *aEvent);
 
111
    gint ProcessMouseEvent(void *aEvent);
 
112
    gint ProcessMouseUpEvent(void *aEvent);
 
113
    gint ProcessMouseOver(void *aEvent, int pane,
 
114
                                gboolean is_dialog, DIALOG_DATA *dialog);
 
115
 
 
116
    gint ProcessKeyDownEvent(void *aEvent);
 
117
    gint ProcessKeyReleaseEvent(void *aEvent);
 
118
 
 
119
    void DoCommand (const char *aAcommand);
 
120
 
 
121
    nsresult OpenStream (const char *aBaseURI, const char *aContentType);
 
122
    nsresult AppendToStream (const PRUint8 *aData, PRUint32 aLen);
 
123
    nsresult CloseStream (void);
 
124
    void ContentStateChange(void);
 
125
    void SetRTL();
 
126
    PRBool Find(const char* aSearchString);
 
127
    PRBool FindAgain(PRBool aForward);
 
128
    void SetSelectionAttention (PRBool aAttention);
 
129
    void JumpToAnchor (const char *anchor);
 
130
    void GetListener (void);
 
131
    void SetFindProperties (PRBool aCaseSensitive);
 
132
 
 
133
    void ChildFocusIn(void);
 
134
    void ChildFocusOut(void);
 
135
 
 
136
    EmbedEventListener *mEventListener;
 
137
    nsCOMPtr<nsISupports> mEventListenerGuard;
 
138
    PRBool mListenersAttached;
 
139
    nsCOMPtr<nsIDOMEventTarget> mEventTarget;
 
140
 
 
141
    nsString mLinkMessage;
 
142
    GeckoHtml *mOwner;
 
143
 
 
144
protected:
 
145
    nativeWindow mWindow;
 
146
    PRUint32     mChromeFlags;
 
147
    PRBool       mContinueModalLoop;
 
148
    focusCallback mFocusCallback;
 
149
    uriCallback mURICallback;
 
150
    networkCallback mNetworkCallback;
 
151
    void* mFocusCallbackData;
 
152
    void* mURICallbackData;
 
153
    void* mNetworkCallbackData;
 
154
    PRPackedBool mInitialised;
 
155
    PRPackedBool mSelectionAttention;
 
156
    nsCOMPtr<nsITypeAheadFind> mFinder;
 
157
 
 
158
    nsCOMPtr<nsIWebBrowser> mWebBrowser;
 
159
    nsCOMPtr<nsIWebNavigation> mWebNavigation;
 
160
    nsCOMPtr<nsIURIContentListener> mParentContentListener;
 
161
    void log(int level, char* string);
 
162
 
 
163
 private:
 
164
    void AttachListeners (void);
 
165
    void DetachListeners (void);
 
166
    nsresult GetPIDOMWindow(nsPIDOMWindow **aPIWin);
 
167
 
 
168
};
 
169
 
 
170
/* Couple of utility functions, since the XPCOM Macros don't seem to work from
 
171
 * Cython.
 
172
 */
 
173
void addref(BrowserEmbed* browser);
 
174
void release(BrowserEmbed* browser);
 
175
 
 
176
#endif /* __PCF_MIRO_BROWSER_EMBED_H__ */