Follow-on fix for bug 457825. Use sheet principal for agent and user sheets. r=dbaron...
[wine-gecko.git] / embedding / browser / photon / src / PtMozilla.h
blobb0fc316c16cf4073ed6309bf62870246c115a51a
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is mozilla.org code.
16 * The Initial Developer of the Original Code is
17 * Christopher Blizzard.
18 * Portions created by the Initial Developer are Copyright (C) 2001
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
22 * Christopher Blizzard <blizzard@mozilla.org>
23 * Brian Edmond <briane@qnx.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
40 #ifndef __PT_MOZILLA_H_INCLUDED
41 #define __PT_MOZILLA_H_INCLUDED
43 #include <stdlib.h>
44 #include <string.h>
46 #include <photon/PtWebClient.h>
47 #include <photon/PpProto.h>
49 #if 0
50 #include "nsIInputStream.h"
51 #include "nsILoadGroup.h"
52 #include "nsIChannel.h"
53 #include "nsIContentViewer.h"
54 #include "nsIStreamListener.h"
55 #include "nsISHistory.h"
56 #include "nsIHistoryEntry.h"
57 #endif
60 * PtMozilla public
63 extern PtWidgetClassRef_t *PtMozilla;
65 class EmbedDownload; /* forward declaration */
67 /* Resources */
69 #define Pt_ARG_MOZ_GET_URL Pt_RESOURCE( 104, 0 )
70 #define Pt_ARG_MOZ_NAVIGATE_PAGE Pt_RESOURCE( 104, 1 )
71 #define Pt_ARG_MOZ_RELOAD Pt_RESOURCE( 104, 2 )
72 #define Pt_ARG_MOZ_STOP Pt_RESOURCE( 104, 3 )
73 #define Pt_ARG_MOZ_PRINT Pt_RESOURCE( 104, 4 )
74 #define Pt_ARG_MOZ_COMMAND Pt_RESOURCE( 104, 5 )
75 #define Pt_ARG_MOZ_OPTION Pt_RESOURCE( 104, 6 )
76 #define Pt_ARG_MOZ_ENCODING Pt_RESOURCE( 104, 7 )
77 #define Pt_ARG_MOZ_WEB_DATA Pt_RESOURCE( 104, 8 )
78 #define Pt_ARG_MOZ_WEB_DATA_URL Pt_RESOURCE( 104, 9 )
79 #define Pt_ARG_MOZ_GET_CONTEXT Pt_RESOURCE( 104, 10 )
80 #define Pt_ARG_MOZ_UNKNOWN_RESP Pt_RESOURCE( 104, 11 )
81 #define Pt_ARG_MOZ_DOWNLOAD Pt_RESOURCE( 104, 12 )
82 #define Pt_ARG_MOZ_GET_HISTORY Pt_RESOURCE( 104, 13 )
83 #define Pt_ARG_MOZ_AUTH_CTRL Pt_RESOURCE( 104, 14 ) // used internally for authentification
84 #define Pt_ARG_MOZ_UNKNOWN_CTRL Pt_RESOURCE( 104, 15 ) // used internally for downloading
86 #define Pt_CB_MOZ_PROGRESS Pt_RESOURCE( 104, 20 )
87 #define Pt_CB_MOZ_START Pt_RESOURCE( 104, 21 )
88 #define Pt_CB_MOZ_COMPLETE Pt_RESOURCE( 104, 22 )
89 #define Pt_CB_MOZ_NET_STATE Pt_RESOURCE( 104, 23 )
90 #define Pt_CB_MOZ_URL Pt_RESOURCE( 104, 24 )
91 #define Pt_CB_MOZ_INFO Pt_RESOURCE( 104, 25 )
92 #define Pt_CB_MOZ_OPEN Pt_RESOURCE( 104, 26 )
93 #define Pt_CB_MOZ_NEW_WINDOW Pt_RESOURCE( 104, 27 )
94 #define Pt_CB_MOZ_DIALOG Pt_RESOURCE( 104, 28 )
95 #define Pt_CB_MOZ_AUTHENTICATE Pt_RESOURCE( 104, 29 )
96 #define Pt_CB_MOZ_PROMPT Pt_RESOURCE( 104, 30 )
97 #define Pt_CB_MOZ_NEW_AREA Pt_RESOURCE( 104, 31 )
98 #define Pt_CB_MOZ_VISIBILITY Pt_RESOURCE( 104, 32 )
99 #define Pt_CB_MOZ_DESTROY Pt_RESOURCE( 104, 33 )
100 #define Pt_CB_MOZ_EVENT Pt_RESOURCE( 104, 35 )
101 #define Pt_CB_MOZ_CONTEXT Pt_RESOURCE( 104, 36 )
102 #define Pt_CB_MOZ_PRINT_STATUS Pt_RESOURCE( 104, 37 )
103 #define Pt_CB_MOZ_WEB_DATA_REQ Pt_RESOURCE( 104, 38 )
104 #define Pt_CB_MOZ_UNKNOWN Pt_RESOURCE( 104, 39 )
105 #define Pt_CB_MOZ_ERROR Pt_RESOURCE( 104, 40 )
106 #define Pt_CB_MOZ_DOWNLOAD Pt_RESOURCE( 104, 41 )
109 #define MAX_URL_LENGTH 1024
111 typedef enum
113 MOZ_EMBED_FLAG_RELOADNORMAL = 0,
114 MOZ_EMBED_FLAG_RELOADBYPASSCACHE = 1,
115 MOZ_EMBED_FLAG_RELOADBYPASSPROXY = 2,
116 MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE = 3,
117 MOZ_EMBED_FLAG_RELOADCHARSETCHANGE = 4
118 } MozEmbedReloadFlags;
120 // progress callback, can be itemized or full
121 #define Pt_MOZ_PROGRESS 1
122 #define Pt_MOZ_PROGRESS_ALL 2
123 typedef struct mozilla_progress_t
125 int type; // unused at this time
126 int32_t cur;
127 int32_t max;
128 } PtMozillaProgressCb_t;
130 // url change callback, also used for open callback
131 // the open callback returns Pt_END to cancel the open of that site
132 typedef struct mozilla_url_t
134 char *url;
135 } PtMozillaUrlCb_t;
137 // info callback for Java Script, link messages, titles
138 #define Pt_MOZ_INFO_TITLE 1
139 #define Pt_MOZ_INFO_JSSTATUS 2
140 #define Pt_MOZ_INFO_LINK 3
141 #define Pt_MOZ_INFO_SSL 4 // uses status field
142 // status can be
143 #define Pt_SSL_STATE_IS_INSECURE 0x1
144 #define Pt_SSL_STATE_IS_BROKEN 0x2
145 #define Pt_SSL_STATE_IS_SECURE 0x4
146 #define Pt_SSL_STATE_SECURE_HIGH 0x8
147 #define Pt_SSL_STATE_SECURE_MED 0x10
148 #define Pt_SSL_STATE_SECURE_LOW 0x20
149 #define Pt_MOZ_INFO_CONNECT 5
151 typedef struct mozilla_info_t
153 int type;
154 unsigned long status;
155 char *data;
156 } PtMozillaInfoCb_t;
158 // authentication callback, fill username and password in
159 // return Pt_END from the callback to cancel authentication
160 typedef struct mozilla_authenticate_t
162 char *title;
163 char *realm;
164 char user[128];
165 char pass[128];
166 } PtMozillaAuthenticateCb_t;
168 // dialog callback, the _CHECK ones use message and expect an answer in ret_value
169 // the CONFIRM dialogs must return Pt_CONTINUE to confirm and Pt_END to deny
170 #define Pt_MOZ_DIALOG_ALERT 1
171 #define Pt_MOZ_DIALOG_ALERT_CHECK 2
172 #define Pt_MOZ_DIALOG_CONFIRM 3
173 #define Pt_MOZ_DIALOG_CONFIRM_CHECK 4
174 typedef struct mozilla_dialog_t
176 int type;
177 PtWidget_t *parent;
178 char *title;
179 char *text;
180 char *checkbox_message;
181 int ret_value;
182 } PtMozillaDialogCb_t;
184 // raw net state callback
185 // flags can be:
186 // STATE_START
187 // STATE_REDIRECTING
188 // STATE_TRANSFERRING
189 // STATE_NEGOTIATING
190 // STATE_STOP
191 // STATE_IS_REQUEST
192 // STATE_IS_DOCUMENT
193 // STATE_IS_NETWORK
194 // STATE_IS_WINDOW
195 typedef struct mozilla_net_state_t
197 int flags;
198 unsigned int status;
199 const char *url;
200 char *message;
201 } PtMozillaNetStateCb_t;
203 // new window callback
204 typedef enum
206 Pt_MOZ_FLAG_DEFAULTCHROME = 1U,
207 Pt_MOZ_FLAG_WINDOWBORDERSON = 2U,
208 Pt_MOZ_FLAG_WINDOWCLOSEON = 4U,
209 Pt_MOZ_FLAG_WINDOWRESIZEON = 8U,
210 Pt_MOZ_FLAG_MENUBARON = 16U,
211 Pt_MOZ_FLAG_TOOLBARON = 32U,
212 Pt_MOZ_FLAG_LOCATIONBARON = 64U,
213 Pt_MOZ_FLAG_STATUSBARON = 128U,
214 Pt_MOZ_FLAG_PERSONALTOOLBARON = 256U,
215 Pt_MOZ_FLAG_SCROLLBARSON = 512U,
216 Pt_MOZ_FLAG_TITLEBARON = 1024U,
217 Pt_MOZ_FLAG_EXTRACHROMEON = 2048U,
218 Pt_MOZ_FLAG_ALLCHROME = 4094U,
219 Pt_MOZ_FLAG_WINDOWRAISED = 33554432U,
220 Pt_MOZ_FLAG_WINDOWLOWERED = 67108864U,
221 Pt_MOZ_FLAG_CENTERSCREEN = 134217728U,
222 Pt_MOZ_FLAG_DEPENDENT = 268435456U,
223 Pt_MOZ_FLAG_MODAL = 536870912U,
224 Pt_MOZ_FLAG_OPENASDIALOG = 1073741824U,
225 Pt_MOZ_FLAG_OPENASCHROME = 2147483648U
226 } PtMozillaWindowFlags;
227 typedef struct mozilla_new_window_t
229 PtWidget_t *widget;
230 unsigned int window_flags;
231 PhDim_t window_size;
232 } PtMozillaNewWindowCb_t;
234 typedef struct mozilla_prompt_t
236 char *title;
237 char *text;
238 char *dflt_resp;
239 char response[128];
240 } PtMozillaPromptCb_t;
242 /* for PtMozillaNewAreaCb_t flags */
243 #define Pt_MOZ_NEW_AREA_SET_SIZE 0x1
244 #define Pt_MOZ_NEW_AREA_SET_POSITION 0x2
245 #define Pt_MOZ_NEW_AREA_SET_AREA 0x4
247 typedef struct mozilla_new_area_t
249 PhArea_t area;
250 unsigned int flags;
251 } PtMozillaNewAreaCb_t;
253 typedef struct mozilla_visibility_t
255 int show;
256 } PtMozillaVisibilityCb_t;
258 // context menu
259 #define Pt_MOZ_CONTEXT_NONE 0x0
260 #define Pt_MOZ_CONTEXT_LINK 0x1
261 #define Pt_MOZ_CONTEXT_IMAGE 0x2
262 #define Pt_MOZ_CONTEXT_DOCUMENT 0x4
263 #define Pt_MOZ_CONTEXT_TEXT 0x8
264 #define Pt_MOZ_CONTEXT_INPUT 0x10
265 typedef struct mozilla_context_t
267 unsigned flags;
268 PRInt32 x, y;
269 } PtMozillaContextCb_t;
271 typedef struct mozilla_data_request_cb_t {
272 int type;
273 int length;
274 char *url;
275 } PtMozillaDataRequestCb_t;
277 typedef struct {
278 short response;
279 char filename[PATH_MAX];
280 char url[MAX_URL_LENGTH];
281 } PtMozUnknownResp_t;
283 typedef struct mozilla_event_t
285 int flag;
286 } PtMozillaEvent_t;
288 // print status
289 #define Pt_MOZ_PRINT_START 1
290 #define Pt_MOZ_PRINT_COMPLETE 2
291 #define Pt_MOZ_PRINT_PROGRESS 3
292 typedef struct mozilla_print_status_t
294 int status;
295 unsigned int cur;
296 unsigned int max;
297 } PtMozillaPrintStatusCb_t;
299 // convienience functions
300 #define Pt_MOZ_PREF_BOOL 1
301 #define Pt_MOZ_PREF_CHAR 2
302 #define Pt_MOZ_PREF_INT 3
303 #define Pt_MOZ_PREF_COLOR 4
304 void MozSetPreference(PtWidget_t *widget, int type, char *pref, void *data);
306 // mozilla commands
307 enum
309 Pt_MOZ_COMMAND_CUT,
310 Pt_MOZ_COMMAND_COPY,
311 Pt_MOZ_COMMAND_PASTE,
312 Pt_MOZ_COMMAND_SELECTALL,
313 Pt_MOZ_COMMAND_CLEAR,
314 Pt_MOZ_COMMAND_FIND,
315 Pt_MOZ_COMMAND_SAVEAS
318 typedef struct {
319 short response;
320 char user[255];
321 char pass[255];
322 PtModalCtrl_t ctrl;
323 } PtMozillaAuthCtrl_t;
325 typedef struct {
326 short response, waiting;
327 char *filename;
328 long download_ticket;
329 PtModalCtrl_t ctrl;
330 } PtMozillaUnknownCtrl_t;
332 class EmbedPrivate;
334 typedef struct Pt_mozilla_client_widget
336 PtContainerWidget_t container;
338 // Mozilla interfaces
339 EmbedPrivate *EmbedRef;
341 char url[MAX_URL_LENGTH];
342 int navigate_flags;
343 char disable_exception_dlg, disable_new_windows, toActivate, spare[1];
345 int fDownloadCount;
346 EmbedDownload **fDownload;
348 /* text_zoom is the text zooming as set by the client ( 100 = 100% ) */
349 short int text_zoom;
350 /* actual_text_zoom is the text zooming as returned by the browser - when a window is being created
351 the client tries to set the text zooming, but there is no content loaded. Use actual_text_zoom
352 to remember to set the zooming when the content is loaded */
353 short int actual_text_zoom;
355 char *rightClickUrl_image; /* keep the url the user clicked on, to provide it latter for Pt_ARG_WEB_GET_CONTEXT */
356 char *rightClickUrl_link; /* keep the url the user clicked on, to provide it latter for Pt_ARG_WEB_GET_CONTEXT */
358 PtMozillaAuthCtrl_t *moz_auth_ctrl;
359 PtMozillaUnknownCtrl_t *moz_unknown_ctrl;
361 // callbacks
362 PtCallbackList_t *title_cb;
363 PtCallbackList_t *net_state_cb;
364 PtCallbackList_t *info_cb;
365 PtCallbackList_t *progress_cb;
366 PtCallbackList_t *start_cb;
367 PtCallbackList_t *complete_cb;
368 PtCallbackList_t *url_cb;
369 PtCallbackList_t *event_cb;
370 PtCallbackList_t *resize_cb;
371 PtCallbackList_t *new_window_cb;
372 PtCallbackList_t *destroy_cb;
373 PtCallbackList_t *visibility_cb; /* obsolete - delete it latter */
374 PtCallbackList_t *open_cb;
375 PtCallbackList_t *dialog_cb;
376 PtCallbackList_t *auth_cb;
377 PtCallbackList_t *prompt_cb;
378 PtCallbackList_t *context_cb;
379 PtCallbackList_t *print_status_cb;
380 PtCallbackList_t *web_data_req_cb;
381 PtCallbackList_t *web_unknown_cb;
382 PtCallbackList_t *web_error_cb;
383 PtCallbackList_t *web_download_cb;
384 } PtMozillaWidget_t;
386 /* Widget union */
387 typedef union Pt_mozilla_union
389 PtWidget_t core;
390 PtBasicWidget_t basic;
391 PtContainerWidget_t cntnr;
392 PtMozillaWidget_t moz;
393 } PtMozillaUnion_t;
396 #endif