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 "extensions/browser/api/web_request/web_request_api_helpers.h" | 5 #include "extensions/browser/api/web_request/web_request_api_helpers.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // Creates a NetLog callback the returns a Value with the ID of the extension | 211 // Creates a NetLog callback the returns a Value with the ID of the extension |
212 // that caused an event. |delta| must remain valid for the lifetime of the | 212 // that caused an event. |delta| must remain valid for the lifetime of the |
213 // callback. | 213 // callback. |
214 net::NetLog::ParametersCallback CreateNetLogExtensionIdCallback( | 214 net::NetLog::ParametersCallback CreateNetLogExtensionIdCallback( |
215 const EventResponseDelta* delta) { | 215 const EventResponseDelta* delta) { |
216 return net::NetLog::StringCallback("extension_id", &delta->extension_id); | 216 return net::NetLog::StringCallback("extension_id", &delta->extension_id); |
217 } | 217 } |
218 | 218 |
219 // Creates NetLog parameters to indicate that an extension modified a request. | 219 // Creates NetLog parameters to indicate that an extension modified a request. |
220 // Caller takes ownership of returned value. | 220 // Caller takes ownership of returned value. |
221 base::Value* NetLogModificationCallback( | 221 base::Value* NetLogModificationCallback(const EventResponseDelta* delta, |
222 const EventResponseDelta* delta, | 222 net::NetLogCaptureMode capture_mode) { |
223 net::NetLog::LogLevel log_level) { | |
224 base::DictionaryValue* dict = new base::DictionaryValue(); | 223 base::DictionaryValue* dict = new base::DictionaryValue(); |
225 dict->SetString("extension_id", delta->extension_id); | 224 dict->SetString("extension_id", delta->extension_id); |
226 | 225 |
227 base::ListValue* modified_headers = new base::ListValue(); | 226 base::ListValue* modified_headers = new base::ListValue(); |
228 net::HttpRequestHeaders::Iterator modification( | 227 net::HttpRequestHeaders::Iterator modification( |
229 delta->modified_request_headers); | 228 delta->modified_request_headers); |
230 while (modification.GetNext()) { | 229 while (modification.GetNext()) { |
231 std::string line = modification.name() + ": " + modification.value(); | 230 std::string line = modification.name() + ": " + modification.value(); |
232 modified_headers->Append(new base::StringValue(line)); | 231 modified_headers->Append(new base::StringValue(line)); |
233 } | 232 } |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 std::find(kResourceTypeStrings, | 1279 std::find(kResourceTypeStrings, |
1281 kResourceTypeStrings + kResourceTypeStringsLength, | 1280 kResourceTypeStrings + kResourceTypeStringsLength, |
1282 type_str); | 1281 type_str); |
1283 if (iter == (kResourceTypeStrings + kResourceTypeStringsLength)) | 1282 if (iter == (kResourceTypeStrings + kResourceTypeStringsLength)) |
1284 return false; | 1283 return false; |
1285 *type = kResourceTypeValues[iter - kResourceTypeStrings]; | 1284 *type = kResourceTypeValues[iter - kResourceTypeStrings]; |
1286 return true; | 1285 return true; |
1287 } | 1286 } |
1288 | 1287 |
1289 } // namespace extension_web_request_api_helpers | 1288 } // namespace extension_web_request_api_helpers |
OLD | NEW |