| 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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 const ResourceLoaderBridge::ResponseInfo& info, | 165 const ResourceLoaderBridge::ResponseInfo& info, |
| 166 WebURLResponse* response) { | 166 WebURLResponse* response) { |
| 167 response->setURL(url); | 167 response->setURL(url); |
| 168 response->setResponseTime(info.response_time.ToDoubleT()); | 168 response->setResponseTime(info.response_time.ToDoubleT()); |
| 169 response->setMIMEType(WebString::fromUTF8(info.mime_type)); | 169 response->setMIMEType(WebString::fromUTF8(info.mime_type)); |
| 170 response->setTextEncodingName(WebString::fromUTF8(info.charset)); | 170 response->setTextEncodingName(WebString::fromUTF8(info.charset)); |
| 171 response->setExpectedContentLength(info.content_length); | 171 response->setExpectedContentLength(info.content_length); |
| 172 response->setSecurityInfo(info.security_info); | 172 response->setSecurityInfo(info.security_info); |
| 173 response->setAppCacheID(info.appcache_id); | 173 response->setAppCacheID(info.appcache_id); |
| 174 response->setAppCacheManifestURL(info.appcache_manifest_url); | 174 response->setAppCacheManifestURL(info.appcache_manifest_url); |
| 175 response->setWasCached(info.request_time > info.response_time); | 175 response->setWasCached(!info.load_timing.base_time.is_null() && |
| 176 info.response_time < info.load_timing.base_time); |
| 176 response->setWasFetchedViaSPDY(info.was_fetched_via_spdy); | 177 response->setWasFetchedViaSPDY(info.was_fetched_via_spdy); |
| 177 response->setWasNpnNegotiated(info.was_npn_negotiated); | 178 response->setWasNpnNegotiated(info.was_npn_negotiated); |
| 178 response->setWasAlternateProtocolAvailable( | 179 response->setWasAlternateProtocolAvailable( |
| 179 info.was_alternate_protocol_available); | 180 info.was_alternate_protocol_available); |
| 180 response->setWasFetchedViaProxy(info.was_fetched_via_proxy); | 181 response->setWasFetchedViaProxy(info.was_fetched_via_proxy); |
| 181 response->setConnectionID(info.connection_id); | 182 response->setConnectionID(info.connection_id); |
| 183 response->setConnectionReused(info.connection_reused); |
| 182 | 184 |
| 183 WebURLLoadTiming timing; | 185 WebURLLoadTiming timing; |
| 184 timing.initialize(); | 186 timing.initialize(); |
| 185 const ResourceLoaderBridge::LoadTimingInfo& timing_info = info.load_timing; | 187 const ResourceLoaderBridge::LoadTimingInfo& timing_info = info.load_timing; |
| 186 timing.setRequestTime(timing_info.base_time.ToDoubleT()); | 188 timing.setRequestTime(timing_info.base_time.ToDoubleT()); |
| 187 timing.setProxyStart(timing_info.proxy_start); | 189 timing.setProxyStart(timing_info.proxy_start); |
| 188 timing.setProxyEnd(timing_info.proxy_end); | 190 timing.setProxyEnd(timing_info.proxy_end); |
| 189 timing.setDNSStart(timing_info.dns_start); | 191 timing.setDNSStart(timing_info.dns_start); |
| 190 timing.setDNSEnd(timing_info.dns_end); | 192 timing.setDNSEnd(timing_info.dns_end); |
| 191 timing.setConnectStart(timing_info.connect_start); | 193 timing.setConnectStart(timing_info.connect_start); |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 | 678 |
| 677 void WebURLLoaderImpl::cancel() { | 679 void WebURLLoaderImpl::cancel() { |
| 678 context_->Cancel(); | 680 context_->Cancel(); |
| 679 } | 681 } |
| 680 | 682 |
| 681 void WebURLLoaderImpl::setDefersLoading(bool value) { | 683 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 682 context_->SetDefersLoading(value); | 684 context_->SetDefersLoading(value); |
| 683 } | 685 } |
| 684 | 686 |
| 685 } // namespace webkit_glue | 687 } // namespace webkit_glue |
| OLD | NEW |