| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 // Extracts the information from a data: url. | 112 // Extracts the information from a data: url. |
| 113 bool GetInfoFromDataURL(const GURL& url, | 113 bool GetInfoFromDataURL(const GURL& url, |
| 114 ResourceResponseInfo* info, | 114 ResourceResponseInfo* info, |
| 115 std::string* data, | 115 std::string* data, |
| 116 net::URLRequestStatus* status) { | 116 net::URLRequestStatus* status) { |
| 117 std::string mime_type; | 117 std::string mime_type; |
| 118 std::string charset; | 118 std::string charset; |
| 119 if (net::DataURL::Parse(url, &mime_type, &charset, data)) { | 119 if (net::DataURL::Parse(url, &mime_type, &charset, data)) { |
| 120 *status = net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0); | 120 *status = net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0); |
| 121 info->request_time = Time::Now(); | 121 // Assure same time for all time fields of data: URLs. |
| 122 info->response_time = Time::Now(); | 122 Time now = Time::Now(); |
| 123 info->load_timing.base_time = now; |
| 124 info->request_time = now; |
| 125 info->response_time = now; |
| 123 info->headers = NULL; | 126 info->headers = NULL; |
| 124 info->mime_type.swap(mime_type); | 127 info->mime_type.swap(mime_type); |
| 125 info->charset.swap(charset); | 128 info->charset.swap(charset); |
| 126 info->security_info.clear(); | 129 info->security_info.clear(); |
| 127 info->content_length = -1; | 130 info->content_length = -1; |
| 128 info->encoded_data_length = 0; | 131 info->encoded_data_length = 0; |
| 129 info->load_timing.base_time = Time::Now(); | |
| 130 | 132 |
| 131 return true; | 133 return true; |
| 132 } | 134 } |
| 133 | 135 |
| 134 *status = net::URLRequestStatus(net::URLRequestStatus::FAILED, | 136 *status = net::URLRequestStatus(net::URLRequestStatus::FAILED, |
| 135 net::ERR_INVALID_URL); | 137 net::ERR_INVALID_URL); |
| 136 return false; | 138 return false; |
| 137 } | 139 } |
| 138 | 140 |
| 139 typedef ResourceDevToolsInfo::HeadersVector HeadersVector; | 141 typedef ResourceDevToolsInfo::HeadersVector HeadersVector; |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 723 |
| 722 void WebURLLoaderImpl::cancel() { | 724 void WebURLLoaderImpl::cancel() { |
| 723 context_->Cancel(); | 725 context_->Cancel(); |
| 724 } | 726 } |
| 725 | 727 |
| 726 void WebURLLoaderImpl::setDefersLoading(bool value) { | 728 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 727 context_->SetDefersLoading(value); | 729 context_->SetDefersLoading(value); |
| 728 } | 730 } |
| 729 | 731 |
| 730 } // namespace webkit_glue | 732 } // namespace webkit_glue |
| OLD | NEW |