| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 for (extensions::ExtensionSet::const_iterator it = extensions.begin(); | 1268 for (extensions::ExtensionSet::const_iterator it = extensions.begin(); |
| 1269 !webrequest_used && it != extensions.end(); | 1269 !webrequest_used && it != extensions.end(); |
| 1270 ++it) { | 1270 ++it) { |
| 1271 webrequest_used |= runtime_data->HasUsedWebRequest((*it)->id()); | 1271 webrequest_used |= runtime_data->HasUsedWebRequest((*it)->id()); |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 host->Send(new ExtensionMsg_UsingWebRequestAPI(webrequest_used)); | 1274 host->Send(new ExtensionMsg_UsingWebRequestAPI(webrequest_used)); |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 // Converts the |name|, |value| pair of a http header to a HttpHeaders | 1277 // Converts the |name|, |value| pair of a http header to a HttpHeaders |
| 1278 // dictionary. Ownership is passed to the caller. | 1278 // dictionary. |
| 1279 base::DictionaryValue* CreateHeaderDictionary( | 1279 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( |
| 1280 const std::string& name, const std::string& value) { | 1280 const std::string& name, |
| 1281 base::DictionaryValue* header = new base::DictionaryValue(); | 1281 const std::string& value) { |
| 1282 std::unique_ptr<base::DictionaryValue> header(new base::DictionaryValue()); |
| 1282 header->SetString(keys::kHeaderNameKey, name); | 1283 header->SetString(keys::kHeaderNameKey, name); |
| 1283 if (base::IsStringUTF8(value)) { | 1284 if (base::IsStringUTF8(value)) { |
| 1284 header->SetString(keys::kHeaderValueKey, value); | 1285 header->SetString(keys::kHeaderValueKey, value); |
| 1285 } else { | 1286 } else { |
| 1286 header->Set(keys::kHeaderBinaryValueKey, | 1287 header->Set(keys::kHeaderBinaryValueKey, |
| 1287 StringToCharList(value)); | 1288 StringToCharList(value)); |
| 1288 } | 1289 } |
| 1289 return header; | 1290 return header; |
| 1290 } | 1291 } |
| 1291 | 1292 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1314 for (size_t i = 0; i < kResourceTypeStringsLength; ++i) { | 1315 for (size_t i = 0; i < kResourceTypeStringsLength; ++i) { |
| 1315 if (type_str == kResourceTypeStrings[i]) { | 1316 if (type_str == kResourceTypeStrings[i]) { |
| 1316 found = true; | 1317 found = true; |
| 1317 types->push_back(kResourceTypeValues[i]); | 1318 types->push_back(kResourceTypeValues[i]); |
| 1318 } | 1319 } |
| 1319 } | 1320 } |
| 1320 return found; | 1321 return found; |
| 1321 } | 1322 } |
| 1322 | 1323 |
| 1323 } // namespace extension_web_request_api_helpers | 1324 } // namespace extension_web_request_api_helpers |
| OLD | NEW |