gdi32: Fix leak in GdiDeleteSpoolFileHandle.
[wine.git] / dlls / mshtml / binding.h
blob05db46db772d458ee036492ecf77e4719a80067e
1 /*
2 * Copyright 2011 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 typedef struct nsWineURI nsWineURI;
21 /* Keep sync with request_method_strings in nsio.c */
22 typedef enum {
23 METHOD_GET,
24 METHOD_PUT,
25 METHOD_POST
26 } REQUEST_METHOD;
28 typedef enum {
29 BOM_NONE,
30 BOM_UTF8,
31 BOM_UTF16
32 } binding_bom_t;
34 typedef struct {
35 nsIHttpChannel nsIHttpChannel_iface;
36 nsIUploadChannel nsIUploadChannel_iface;
37 nsIHttpChannelInternal nsIHttpChannelInternal_iface;
38 nsICacheInfoChannel nsICacheInfoChannel_iface;
40 nsCycleCollectingAutoRefCnt ccref;
42 nsWineURI *uri;
43 nsIInputStream *post_data_stream;
44 BOOL post_data_contains_headers;
45 nsILoadGroup *load_group;
46 nsIInterfaceRequestor *notif_callback;
47 nsISupports *owner;
48 nsILoadInfo *load_info;
49 nsLoadFlags load_flags;
50 nsIURI *original_uri;
51 nsIURI *referrer;
52 char *content_type;
53 char *charset;
54 nsresult status;
55 UINT32 response_status;
56 char *response_status_text;
57 REQUEST_METHOD request_method;
58 struct list response_headers;
59 struct list request_headers;
61 nsChannelBSC *binding;
62 } nsChannel;
64 typedef struct {
65 nsIInputStream *post_stream;
66 WCHAR *headers;
67 HGLOBAL post_data;
68 ULONG post_data_len;
69 } request_data_t;
71 typedef struct BSCallbackVtbl BSCallbackVtbl;
73 struct BSCallback {
74 IBindStatusCallback IBindStatusCallback_iface;
75 IServiceProvider IServiceProvider_iface;
76 IHttpNegotiate2 IHttpNegotiate2_iface;
77 IInternetBindInfo IInternetBindInfo_iface;
78 IBindCallbackRedirect IBindCallbackRedirect_iface;
80 const BSCallbackVtbl *vtbl;
82 LONG ref;
84 request_data_t request_data;
85 ULONG read;
86 DWORD bindf;
87 DWORD bindinfo_options;
88 BOOL bindinfo_ready;
89 binding_bom_t bom;
91 IMoniker *mon;
92 IBinding *binding;
94 HTMLInnerWindow *window;
96 struct list entry;
99 typedef struct nsProtocolStream nsProtocolStream;
101 struct nsChannelBSC {
102 BSCallback bsc;
104 nsChannel *nschannel;
105 nsIStreamListener *nslistener;
106 nsISupports *nscontext;
107 ULONG progress;
108 ULONG total;
109 BOOL is_js;
110 BOOL is_doc_channel;
111 BOOL response_processed;
113 nsProtocolStream *nsstream;
116 struct BSCallbackVtbl {
117 void (*destroy)(BSCallback*);
118 HRESULT (*init_bindinfo)(BSCallback*);
119 HRESULT (*start_binding)(BSCallback*);
120 HRESULT (*stop_binding)(BSCallback*,HRESULT);
121 HRESULT (*read_data)(BSCallback*,IStream*);
122 HRESULT (*on_progress)(BSCallback*,ULONG,ULONG,ULONG,LPCWSTR);
123 HRESULT (*on_response)(BSCallback*,DWORD,LPCWSTR);
124 HRESULT (*beginning_transaction)(BSCallback*,WCHAR**);
127 typedef struct {
128 struct list entry;
129 WCHAR *header;
130 WCHAR *data;
131 } http_header_t;
133 #define BINDING_NAVIGATED 0x0001
134 #define BINDING_REPLACE 0x0002
135 #define BINDING_FROMHIST 0x0004
136 #define BINDING_REFRESH 0x0008
137 #define BINDING_SUBMIT 0x0010
138 #define BINDING_NOFRAG 0x0020
140 HRESULT set_http_header(struct list*,const WCHAR*,int,const WCHAR*,int);
141 HRESULT create_redirect_nschannel(const WCHAR*,nsChannel*,nsChannel**);
143 HRESULT hlink_frame_navigate(HTMLDocumentObj*,LPCWSTR,nsChannel*,DWORD,BOOL*);
144 HRESULT create_doc_uri(IUri*,nsWineURI**);
145 HRESULT load_nsuri(HTMLOuterWindow*,nsWineURI*,nsIInputStream*,nsChannelBSC*,DWORD);
146 HRESULT set_moniker(HTMLOuterWindow*,IMoniker*,IUri*,IBindCtx*,nsChannelBSC*,BOOL);
147 void prepare_for_binding(HTMLDocumentObj*,IMoniker*,DWORD);
148 HRESULT super_navigate(HTMLOuterWindow*,IUri*,DWORD,const WCHAR*,BYTE*,DWORD);
149 HRESULT load_uri(HTMLOuterWindow*,IUri*,DWORD);
150 HRESULT navigate_new_window(HTMLOuterWindow*,IUri*,const WCHAR*,request_data_t*,IHTMLWindow2**);
151 HRESULT navigate_url(HTMLOuterWindow*,const WCHAR*,IUri*,DWORD);
152 HRESULT submit_form(HTMLOuterWindow*,const WCHAR*,IUri*,nsIInputStream*);
153 void process_document_response_headers(HTMLDocumentNode*,IBinding*);
155 void init_bscallback(BSCallback*,const BSCallbackVtbl*,IMoniker*,DWORD);
156 HRESULT create_channelbsc(IMoniker*,const WCHAR*,BYTE*,DWORD,BOOL,nsChannelBSC**);
157 HRESULT channelbsc_load_stream(HTMLInnerWindow*,IMoniker*,IStream*);
158 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
159 IUri *nsuri_get_uri(nsWineURI*);
160 nsresult create_onload_blocker_request(nsIRequest**);
162 HRESULT read_stream(BSCallback*,IStream*,void*,DWORD,DWORD*);
164 HRESULT create_relative_uri(HTMLOuterWindow*,const WCHAR*,IUri**);
165 HRESULT create_uri(const WCHAR*,DWORD,IUri**);
166 IUri *get_uri_nofrag(IUri*);
167 BOOL compare_uri_ignoring_frag(IUri *uri1, IUri *uri2);
169 void set_current_mon(HTMLOuterWindow*,IMoniker*,DWORD);
170 void set_current_uri(HTMLOuterWindow*,IUri*);