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 #include "content/browser/devtools/devtools_netlog_observer.h" | 5 #include "content/browser/devtools/devtools_netlog_observer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 info->http_status_code = response_headers->response_code(); | 133 info->http_status_code = response_headers->response_code(); |
134 info->http_status_text = response_headers->GetStatusText(); | 134 info->http_status_text = response_headers->GetStatusText(); |
135 std::string name, value; | 135 std::string name, value; |
136 | 136 |
137 // We need to clear headers in case the same url_request is reused for | 137 // We need to clear headers in case the same url_request is reused for |
138 // several http requests (e.g. see http://crbug.com/80157). | 138 // several http requests (e.g. see http://crbug.com/80157). |
139 info->response_headers.clear(); | 139 info->response_headers.clear(); |
140 | 140 |
141 for (void* it = NULL; | 141 for (size_t it = 0; |
142 response_headers->EnumerateHeaderLines(&it, &name, &value); ) { | 142 response_headers->EnumerateHeaderLines(&it, &name, &value);) { |
143 info->response_headers.push_back(std::make_pair(name, value)); | 143 info->response_headers.push_back(std::make_pair(name, value)); |
144 } | 144 } |
145 | 145 |
146 if (!info->request_headers_text.empty()) { | 146 if (!info->request_headers_text.empty()) { |
147 info->response_headers_text = | 147 info->response_headers_text = |
148 net::HttpUtil::ConvertHeadersBackToHTTPResponse( | 148 net::HttpUtil::ConvertHeadersBackToHTTPResponse( |
149 response_headers->raw_headers()); | 149 response_headers->raw_headers()); |
150 } else { | 150 } else { |
151 // SPDY request. | 151 // SPDY request. |
152 info->response_headers_text = ""; | 152 info->response_headers_text = ""; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 uint32_t source_id = request->net_log().source().id; | 198 uint32_t source_id = request->net_log().source().id; |
199 DevToolsNetLogObserver* dev_tools_net_log_observer = | 199 DevToolsNetLogObserver* dev_tools_net_log_observer = |
200 DevToolsNetLogObserver::GetInstance(); | 200 DevToolsNetLogObserver::GetInstance(); |
201 if (dev_tools_net_log_observer == NULL) | 201 if (dev_tools_net_log_observer == NULL) |
202 return; | 202 return; |
203 response->head.devtools_info = | 203 response->head.devtools_info = |
204 dev_tools_net_log_observer->GetResourceInfo(source_id); | 204 dev_tools_net_log_observer->GetResourceInfo(source_id); |
205 } | 205 } |
206 | 206 |
207 } // namespace content | 207 } // namespace content |
OLD | NEW |