Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: webkit/glue/weburlrequest_impl.cc

Issue 63011: Monster FilePath patch! (Closed)
Patch Set: sync with trunk Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/glue/resource_loader_bridge.h ('k') | webkit/glue/webview_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "config.h" 5 #include "config.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 7
8 MSVC_PUSH_WARNING_LEVEL(0); 8 MSVC_PUSH_WARNING_LEVEL(0);
9 #include "FormData.h" 9 #include "FormData.h"
10 #include "HTTPHeaderMap.h" 10 #include "HTTPHeaderMap.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (!formdata) 165 if (!formdata)
166 return; 166 return;
167 167
168 const Vector<WebCore::FormDataElement>& elements = formdata->elements(); 168 const Vector<WebCore::FormDataElement>& elements = formdata->elements();
169 Vector<WebCore::FormDataElement>::const_iterator it = elements.begin(); 169 Vector<WebCore::FormDataElement>::const_iterator it = elements.begin();
170 for (; it != elements.end(); ++it) { 170 for (; it != elements.end(); ++it) {
171 const WebCore::FormDataElement& element = (*it); 171 const WebCore::FormDataElement& element = (*it);
172 if (element.m_type == WebCore::FormDataElement::data) { 172 if (element.m_type == WebCore::FormDataElement::data) {
173 data->AppendBytes(element.m_data.data(), element.m_data.size()); 173 data->AppendBytes(element.m_data.data(), element.m_data.size());
174 } else if (element.m_type == WebCore::FormDataElement::encodedFile) { 174 } else if (element.m_type == WebCore::FormDataElement::encodedFile) {
175 data->AppendFile(webkit_glue::StringToStdWString(element.m_filename)); 175 data->AppendFile(
176 FilePath(webkit_glue::StringToFilePathString(element.m_filename)));
176 } else { 177 } else {
177 NOTREACHED(); 178 NOTREACHED();
178 } 179 }
179 } 180 }
180 181
181 data->set_identifier(formdata->identifier()); 182 data->set_identifier(formdata->identifier());
182 } 183 }
183 184
184 void WebRequestImpl::SetUploadData(const net::UploadData& data) 185 void WebRequestImpl::SetUploadData(const net::UploadData& data)
185 { 186 {
186 RefPtr<WebCore::FormData> formdata = WebCore::FormData::create(); 187 RefPtr<WebCore::FormData> formdata = WebCore::FormData::create();
187 188
188 const std::vector<net::UploadData::Element>& elements = data.elements(); 189 const std::vector<net::UploadData::Element>& elements = data.elements();
189 std::vector<net::UploadData::Element>::const_iterator it = elements.begin(); 190 std::vector<net::UploadData::Element>::const_iterator it = elements.begin();
190 for (; it != elements.end(); ++it) { 191 for (; it != elements.end(); ++it) {
191 const net::UploadData::Element& element = (*it); 192 const net::UploadData::Element& element = (*it);
192 if (element.type() == net::UploadData::TYPE_BYTES) { 193 if (element.type() == net::UploadData::TYPE_BYTES) {
193 formdata->appendData( 194 formdata->appendData(
194 std::string(element.bytes().begin(), element.bytes().end()).c_str(), 195 std::string(element.bytes().begin(), element.bytes().end()).c_str(),
195 element.bytes().size()); 196 element.bytes().size());
196 } else if (element.type() == net::UploadData::TYPE_FILE) { 197 } else if (element.type() == net::UploadData::TYPE_FILE) {
197 formdata->appendFile( 198 formdata->appendFile(
198 webkit_glue::StdWStringToString(element.file_path())); 199 webkit_glue::FilePathStringToString(element.file_path().value()));
199 } else { 200 } else {
200 NOTREACHED(); 201 NOTREACHED();
201 } 202 }
202 } 203 }
203 204
204 formdata->setIdentifier(data.identifier()); 205 formdata->setIdentifier(data.identifier());
205 206
206 request_.resourceRequest().setHTTPBody(formdata); 207 request_.resourceRequest().setHTTPBody(formdata);
207 } 208 }
208 209
209 void WebRequestImpl::SetRequestorID(int requestor_id) { 210 void WebRequestImpl::SetRequestorID(int requestor_id) {
210 request_.resourceRequest().setRequestorID(requestor_id); 211 request_.resourceRequest().setRequestorID(requestor_id);
211 } 212 }
212 213
213 // static 214 // static
214 WebRequest* WebRequest::Create(const GURL& url) { 215 WebRequest* WebRequest::Create(const GURL& url) {
215 return new WebRequestImpl(url); 216 return new WebRequestImpl(url);
216 } 217 }
OLDNEW
« no previous file with comments | « webkit/glue/resource_loader_bridge.h ('k') | webkit/glue/webview_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698