| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. | 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. |
| 6 | 6 |
| 7 #include "webkit/glue/weburlloader_impl.h" | 7 #include "webkit/glue/weburlloader_impl.h" |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 void PopulateURLResponse( | 144 void PopulateURLResponse( |
| 145 const GURL& url, | 145 const GURL& url, |
| 146 const ResourceLoaderBridge::ResponseInfo& info, | 146 const ResourceLoaderBridge::ResponseInfo& info, |
| 147 WebURLResponse* response) { | 147 WebURLResponse* response) { |
| 148 response->setURL(url); | 148 response->setURL(url); |
| 149 response->setMIMEType(StdStringToWebString(info.mime_type)); | 149 response->setMIMEType(StdStringToWebString(info.mime_type)); |
| 150 response->setTextEncodingName(StdStringToWebString(info.charset)); | 150 response->setTextEncodingName(StdStringToWebString(info.charset)); |
| 151 response->setExpectedContentLength(info.content_length); | 151 response->setExpectedContentLength(info.content_length); |
| 152 response->setSecurityInfo(info.security_info); | 152 response->setSecurityInfo(info.security_info); |
| 153 response->setAppCacheID(info.appcache_id); | 153 response->setAppCacheID(info.appcache_id); |
| 154 // TODO(michaeln): | 154 response->setAppCacheManifestURL(info.appcache_manifest_url); |
| 155 // response->setAppCacheManifestUrl(info.appcache_manifest_url); | |
| 156 | 155 |
| 157 const net::HttpResponseHeaders* headers = info.headers; | 156 const net::HttpResponseHeaders* headers = info.headers; |
| 158 if (!headers) | 157 if (!headers) |
| 159 return; | 158 return; |
| 160 | 159 |
| 161 response->setHTTPStatusCode(headers->response_code()); | 160 response->setHTTPStatusCode(headers->response_code()); |
| 162 response->setHTTPStatusText(StdStringToWebString(headers->GetStatusText())); | 161 response->setHTTPStatusText(StdStringToWebString(headers->GetStatusText())); |
| 163 | 162 |
| 164 // TODO(darin): We should leverage HttpResponseHeaders for this, and this | 163 // TODO(darin): We should leverage HttpResponseHeaders for this, and this |
| 165 // should be using the same code as ResourceDispatcherHost. | 164 // should be using the same code as ResourceDispatcherHost. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 method, | 330 method, |
| 332 url, | 331 url, |
| 333 request.firstPartyForCookies(), | 332 request.firstPartyForCookies(), |
| 334 referrer_url, | 333 referrer_url, |
| 335 frame_origin, | 334 frame_origin, |
| 336 main_frame_origin, | 335 main_frame_origin, |
| 337 flattener.GetBuffer(), | 336 flattener.GetBuffer(), |
| 338 load_flags, | 337 load_flags, |
| 339 requestor_pid, | 338 requestor_pid, |
| 340 FromTargetType(request.targetType()), | 339 FromTargetType(request.targetType()), |
| 341 request.appCacheContextID(), | 340 request.appCacheHostID(), |
| 342 request.requestorID())); | 341 request.requestorID())); |
| 343 | 342 |
| 344 if (!request.httpBody().isNull()) { | 343 if (!request.httpBody().isNull()) { |
| 345 // GET and HEAD requests shouldn't have http bodies. | 344 // GET and HEAD requests shouldn't have http bodies. |
| 346 DCHECK(method != "GET" && method != "HEAD"); | 345 DCHECK(method != "GET" && method != "HEAD"); |
| 347 const WebHTTPBody& httpBody = request.httpBody(); | 346 const WebHTTPBody& httpBody = request.httpBody(); |
| 348 size_t i = 0; | 347 size_t i = 0; |
| 349 WebHTTPBody::Element element; | 348 WebHTTPBody::Element element; |
| 350 while (httpBody.elementAt(i++, element)) { | 349 while (httpBody.elementAt(i++, element)) { |
| 351 switch (element.type) { | 350 switch (element.type) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 | 566 |
| 568 void WebURLLoaderImpl::cancel() { | 567 void WebURLLoaderImpl::cancel() { |
| 569 context_->Cancel(); | 568 context_->Cancel(); |
| 570 } | 569 } |
| 571 | 570 |
| 572 void WebURLLoaderImpl::setDefersLoading(bool value) { | 571 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 573 context_->SetDefersLoading(value); | 572 context_->SetDefersLoading(value); |
| 574 } | 573 } |
| 575 | 574 |
| 576 } // namespace webkit_glue | 575 } // namespace webkit_glue |
| OLD | NEW |