OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "extensions/browser/api/web_request/web_request_event_details.h" | 5 #include "extensions/browser/api/web_request/web_request_event_details.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 dict_.SetInteger(keys::kStatusCodeKey, request->GetResponseCode()); | 126 dict_.SetInteger(keys::kStatusCodeKey, request->GetResponseCode()); |
127 dict_.SetString(keys::kStatusLineKey, ""); | 127 dict_.SetString(keys::kStatusLineKey, ""); |
128 } else { | 128 } else { |
129 dict_.SetInteger(keys::kStatusCodeKey, response_headers->response_code()); | 129 dict_.SetInteger(keys::kStatusCodeKey, response_headers->response_code()); |
130 dict_.SetString(keys::kStatusLineKey, response_headers->GetStatusLine()); | 130 dict_.SetString(keys::kStatusLineKey, response_headers->GetStatusLine()); |
131 } | 131 } |
132 | 132 |
133 if (extra_info_spec_ & ExtraInfoSpec::RESPONSE_HEADERS) { | 133 if (extra_info_spec_ & ExtraInfoSpec::RESPONSE_HEADERS) { |
134 base::ListValue* headers = new base::ListValue(); | 134 base::ListValue* headers = new base::ListValue(); |
135 if (response_headers) { | 135 if (response_headers) { |
136 void* iter = nullptr; | 136 size_t iter = 0; |
137 std::string name; | 137 std::string name; |
138 std::string value; | 138 std::string value; |
139 while (response_headers->EnumerateHeaderLines(&iter, &name, &value)) | 139 while (response_headers->EnumerateHeaderLines(&iter, &name, &value)) |
140 headers->Append(helpers::CreateHeaderDictionary(name, value)); | 140 headers->Append(helpers::CreateHeaderDictionary(name, value)); |
141 } | 141 } |
142 response_headers_.reset(headers); | 142 response_headers_.reset(headers); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 void WebRequestEventDetails::SetResponseSource(const net::URLRequest* request) { | 146 void WebRequestEventDetails::SetResponseSource(const net::URLRequest* request) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 scoped_ptr<WebRequestEventDetails> self, | 190 scoped_ptr<WebRequestEventDetails> self, |
191 const DeterminedFrameIdCallback& callback, | 191 const DeterminedFrameIdCallback& callback, |
192 int extension_api_frame_id, | 192 int extension_api_frame_id, |
193 int extension_api_parent_frame_id) { | 193 int extension_api_parent_frame_id) { |
194 dict_.SetInteger(keys::kFrameIdKey, extension_api_frame_id); | 194 dict_.SetInteger(keys::kFrameIdKey, extension_api_frame_id); |
195 dict_.SetInteger(keys::kParentFrameIdKey, extension_api_parent_frame_id); | 195 dict_.SetInteger(keys::kParentFrameIdKey, extension_api_parent_frame_id); |
196 callback.Run(std::move(self)); | 196 callback.Run(std::move(self)); |
197 } | 197 } |
198 | 198 |
199 } // namespace extensions | 199 } // namespace extensions |
OLD | NEW |