Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/child/weburlloader_impl.h" | 7 #include "webkit/child/weburlloader_impl.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 std::string mime_type; | 125 std::string mime_type; |
| 126 std::string charset; | 126 std::string charset; |
| 127 if (net::DataURL::Parse(url, &mime_type, &charset, data)) { | 127 if (net::DataURL::Parse(url, &mime_type, &charset, data)) { |
| 128 *error_code = net::OK; | 128 *error_code = net::OK; |
| 129 // Assure same time for all time fields of data: URLs. | 129 // Assure same time for all time fields of data: URLs. |
| 130 Time now = Time::Now(); | 130 Time now = Time::Now(); |
| 131 info->load_timing.request_start = TimeTicks::Now(); | 131 info->load_timing.request_start = TimeTicks::Now(); |
| 132 info->load_timing.request_start_time = now; | 132 info->load_timing.request_start_time = now; |
| 133 info->request_time = now; | 133 info->request_time = now; |
| 134 info->response_time = now; | 134 info->response_time = now; |
| 135 info->headers = NULL; | 135 |
| 136 scoped_refptr<net::HttpResponseHeaders> headers( | |
| 137 new net::HttpResponseHeaders(std::string())); | |
| 138 headers->ReplaceStatusLine("HTTP/1.1 200 OK"); | |
| 139 DCHECK(!mime_type.empty()); | |
| 140 DCHECK(!charset.empty()); | |
| 141 std::string content_type_header = | |
| 142 "Content-Type: " + mime_type + ";charset=" + charset; | |
| 143 headers->AddHeader(content_type_header); | |
| 144 headers->AddHeader("Access-Control-Allow-Origin: *"); | |
|
sof
2013/11/22 21:42:35
Thinking about this a bit more, this will work as
tyoshino (SeeGerritForStatus)
2014/03/11 06:40:37
Right. When withCredentials is set, the response m
| |
| 145 info->headers = headers; | |
| 146 | |
| 136 info->mime_type.swap(mime_type); | 147 info->mime_type.swap(mime_type); |
| 137 info->charset.swap(charset); | 148 info->charset.swap(charset); |
| 138 info->security_info.clear(); | 149 info->security_info.clear(); |
| 139 info->content_length = data->length(); | 150 info->content_length = data->length(); |
| 140 info->encoded_data_length = 0; | 151 info->encoded_data_length = 0; |
| 141 | 152 |
| 142 return true; | 153 return true; |
| 143 } | 154 } |
| 144 | 155 |
| 145 *error_code = net::ERR_INVALID_URL; | 156 *error_code = net::ERR_INVALID_URL; |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 | 856 |
| 846 void WebURLLoaderImpl::setDefersLoading(bool value) { | 857 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 847 context_->SetDefersLoading(value); | 858 context_->SetDefersLoading(value); |
| 848 } | 859 } |
| 849 | 860 |
| 850 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { | 861 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { |
| 851 context_->DidChangePriority(new_priority); | 862 context_->DidChangePriority(new_priority); |
| 852 } | 863 } |
| 853 | 864 |
| 854 } // namespace webkit_glue | 865 } // namespace webkit_glue |
| OLD | NEW |