Revert r66580 and r66579.
[reactos.git] / reactos / dll / win32 / mshtml / binding.h
1 /*
2 * Copyright 2011 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19 #pragma once
20
21 typedef struct nsWineURI nsWineURI;
22
23 /* Keep sync with request_method_strings in nsio.c */
24 typedef enum {
25 METHOD_GET,
26 METHOD_PUT,
27 METHOD_POST
28 } REQUEST_METHOD;
29
30 typedef struct {
31 nsIHttpChannel nsIHttpChannel_iface;
32 nsIUploadChannel nsIUploadChannel_iface;
33 nsIHttpChannelInternal nsIHttpChannelInternal_iface;
34
35 LONG ref;
36
37 nsWineURI *uri;
38 nsIInputStream *post_data_stream;
39 BOOL post_data_contains_headers;
40 nsILoadGroup *load_group;
41 nsIInterfaceRequestor *notif_callback;
42 nsISupports *owner;
43 nsLoadFlags load_flags;
44 nsIURI *original_uri;
45 nsIURI *referrer;
46 char *content_type;
47 char *charset;
48 UINT32 response_status;
49 REQUEST_METHOD request_method;
50 struct list response_headers;
51 struct list request_headers;
52 } nsChannel;
53
54 typedef struct {
55 WCHAR *headers;
56 HGLOBAL post_data;
57 ULONG post_data_len;
58 } request_data_t;
59
60 typedef struct BSCallbackVtbl BSCallbackVtbl;
61
62 struct BSCallback {
63 IBindStatusCallback IBindStatusCallback_iface;
64 IServiceProvider IServiceProvider_iface;
65 IHttpNegotiate2 IHttpNegotiate2_iface;
66 IInternetBindInfo IInternetBindInfo_iface;
67
68 const BSCallbackVtbl *vtbl;
69
70 LONG ref;
71
72 request_data_t request_data;
73 ULONG readed;
74 DWORD bindf;
75 BOOL bindinfo_ready;
76 int bom;
77
78 IMoniker *mon;
79 IBinding *binding;
80
81 HTMLInnerWindow *window;
82
83 struct list entry;
84 };
85
86 typedef struct nsProtocolStream nsProtocolStream;
87
88 struct nsChannelBSC {
89 BSCallback bsc;
90
91 nsChannel *nschannel;
92 nsIStreamListener *nslistener;
93 nsISupports *nscontext;
94 BOOL is_js;
95 BOOL is_doc_channel;
96 BOOL response_processed;
97
98 nsProtocolStream *nsstream;
99 };
100
101 typedef struct {
102 struct list entry;
103 WCHAR *header;
104 WCHAR *data;
105 } http_header_t;
106
107 #define BINDING_NAVIGATED 0x0001
108 #define BINDING_REPLACE 0x0002
109 #define BINDING_FROMHIST 0x0004
110 #define BINDING_REFRESH 0x0008
111 #define BINDING_SUBMIT 0x0010
112 #define BINDING_NOFRAG 0x0020
113
114 HRESULT set_http_header(struct list*,const WCHAR*,int,const WCHAR*,int) DECLSPEC_HIDDEN;
115 HRESULT create_redirect_nschannel(const WCHAR*,nsChannel*,nsChannel**) DECLSPEC_HIDDEN;
116
117 nsresult on_start_uri_open(NSContainer*,nsIURI*,cpp_bool*) DECLSPEC_HIDDEN;
118 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsChannel*,DWORD,BOOL*) DECLSPEC_HIDDEN;
119 HRESULT create_doc_uri(HTMLOuterWindow*,IUri*,nsWineURI**) DECLSPEC_HIDDEN;
120 HRESULT load_nsuri(HTMLOuterWindow*,nsWineURI*,nsChannelBSC*,DWORD) DECLSPEC_HIDDEN;
121 HRESULT set_moniker(HTMLOuterWindow*,IMoniker*,IUri*,IBindCtx*,nsChannelBSC*,BOOL) DECLSPEC_HIDDEN;
122 void prepare_for_binding(HTMLDocument*,IMoniker*,DWORD) DECLSPEC_HIDDEN;
123 HRESULT super_navigate(HTMLOuterWindow*,IUri*,DWORD,const WCHAR*,BYTE*,DWORD) DECLSPEC_HIDDEN;
124 HRESULT load_uri(HTMLOuterWindow*,IUri*,DWORD) DECLSPEC_HIDDEN;
125 HRESULT navigate_new_window(HTMLOuterWindow*,IUri*,const WCHAR*,IHTMLWindow2**) DECLSPEC_HIDDEN;
126 HRESULT navigate_url(HTMLOuterWindow*,const WCHAR*,IUri*,DWORD) DECLSPEC_HIDDEN;
127 HRESULT submit_form(HTMLOuterWindow*,IUri*,nsIInputStream*) DECLSPEC_HIDDEN;
128
129 HRESULT create_channelbsc(IMoniker*,const WCHAR*,BYTE*,DWORD,BOOL,nsChannelBSC**) DECLSPEC_HIDDEN;
130 HRESULT channelbsc_load_stream(HTMLInnerWindow*,IMoniker*,IStream*) DECLSPEC_HIDDEN;
131 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*) DECLSPEC_HIDDEN;
132 IUri *nsuri_get_uri(nsWineURI*) DECLSPEC_HIDDEN;
133
134 HRESULT create_relative_uri(HTMLOuterWindow*,const WCHAR*,IUri**) DECLSPEC_HIDDEN;
135 HRESULT create_uri(const WCHAR*,DWORD,IUri**) DECLSPEC_HIDDEN;
136 IUri *get_uri_nofrag(IUri*) DECLSPEC_HIDDEN;
137
138 void set_current_mon(HTMLOuterWindow*,IMoniker*,DWORD) DECLSPEC_HIDDEN;
139 void set_current_uri(HTMLOuterWindow*,IUri*) DECLSPEC_HIDDEN;
140
141 HRESULT bind_mon_to_wstr(HTMLInnerWindow*,IMoniker*,WCHAR**) DECLSPEC_HIDDEN;