OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // The intent of this file is to provide a type-neutral abstraction between | 5 // The intent of this file is to provide a type-neutral abstraction between |
6 // Chrome and WebKit for resource loading. This pure-virtual interface is | 6 // Chrome and WebKit for resource loading. This pure-virtual interface is |
7 // implemented by the embedder, which also provides a factory method Create | 7 // implemented by the embedder, which also provides a factory method Create |
8 // to instantiate this object. | 8 // to instantiate this object. |
9 // | 9 // |
10 // One of these objects will be created by WebKit for each request. WebKit | 10 // One of these objects will be created by WebKit for each request. WebKit |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // must be encoded. | 137 // must be encoded. |
138 // | 138 // |
139 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload | 139 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload |
140 // methods may be called to construct the body of the request. | 140 // methods may be called to construct the body of the request. |
141 // | 141 // |
142 // For HTTP(S) requests, the headers parameter can be a \r\n-delimited and | 142 // For HTTP(S) requests, the headers parameter can be a \r\n-delimited and |
143 // \r\n-terminated list of MIME headers. They should be ASCII-encoded using | 143 // \r\n-terminated list of MIME headers. They should be ASCII-encoded using |
144 // the standard MIME header encoding rules. The headers parameter can also | 144 // the standard MIME header encoding rules. The headers parameter can also |
145 // be null if no extra request headers need to be set. | 145 // be null if no extra request headers need to be set. |
146 // | 146 // |
147 // The WebFrame passed to this function provides context about the origin | |
148 // of the resource request. | |
149 // | |
150 // policy_url is the URL of the document in the top-level window, which may be | 147 // policy_url is the URL of the document in the top-level window, which may be |
151 // checked by the third-party cookie blocking policy. | 148 // checked by the third-party cookie blocking policy. |
152 // | 149 // |
153 // load_flags is composed of the values defined in url_request_load_flags.h | 150 // load_flags is composed of the values defined in url_request_load_flags.h |
154 // | 151 // |
155 // mixed_content when true indicates that the resource associated with this | 152 // mixed_content when true indicates that the resource associated with this |
156 // request is over HTTP when the main page was loaded over HTTPS. | 153 // request is over HTTP when the main page was loaded over HTTPS. |
157 // | 154 // |
158 // request_type indicates if the current request is the main frame load, a | 155 // request_type indicates if the current request is the main frame load, a |
159 // sub-frame load, or a sub objects load. | 156 // sub-frame load, or a sub objects load. |
160 static ResourceLoaderBridge* Create(WebFrame* frame, | 157 // |
161 const std::string& method, | 158 // routing_id passed to this function allows it to be associated with a |
| 159 // frame's network context. |
| 160 static ResourceLoaderBridge* Create(const std::string& method, |
162 const GURL& url, | 161 const GURL& url, |
163 const GURL& policy_url, | 162 const GURL& policy_url, |
164 const GURL& referrer, | 163 const GURL& referrer, |
165 const std::string& headers, | 164 const std::string& headers, |
166 int load_flags, | 165 int load_flags, |
167 int origin_pid, | 166 int requestor_pid, |
168 ResourceType::Type request_type, | 167 ResourceType::Type request_type, |
169 bool mixed_content); | 168 bool mixed_content, |
| 169 int routing_id); |
170 | 170 |
171 // Call this method before calling Start() to append a chunk of binary data | 171 // Call this method before calling Start() to append a chunk of binary data |
172 // to the request body. May only be used with HTTP(S) POST requests. | 172 // to the request body. May only be used with HTTP(S) POST requests. |
173 virtual void AppendDataToUpload(const char* data, int data_len) = 0; | 173 virtual void AppendDataToUpload(const char* data, int data_len) = 0; |
174 | 174 |
175 // Call this method before calling Start() to append the contents of a file | 175 // Call this method before calling Start() to append the contents of a file |
176 // to the request body. May only be used with HTTP(S) POST requests. | 176 // to the request body. May only be used with HTTP(S) POST requests. |
177 void AppendFileToUpload(const std::wstring& file_path) { | 177 void AppendFileToUpload(const std::wstring& file_path) { |
178 AppendFileRangeToUpload(file_path, 0, kuint64max); | 178 AppendFileRangeToUpload(file_path, 0, kuint64max); |
179 } | 179 } |
(...skipping 30 matching lines...) Expand all Loading... |
210 // construction must go through Create() | 210 // construction must go through Create() |
211 ResourceLoaderBridge(); | 211 ResourceLoaderBridge(); |
212 | 212 |
213 private: | 213 private: |
214 DISALLOW_EVIL_CONSTRUCTORS(ResourceLoaderBridge); | 214 DISALLOW_EVIL_CONSTRUCTORS(ResourceLoaderBridge); |
215 }; | 215 }; |
216 | 216 |
217 } // namespace webkit_glue | 217 } // namespace webkit_glue |
218 | 218 |
219 #endif // RESOURCE_LOADER_BRIDGE_ | 219 #endif // RESOURCE_LOADER_BRIDGE_ |
OLD | NEW |