| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_webrequest_api.h" | 5 #include "chrome/browser/extensions/extension_webrequest_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 header->SetString(keys::kHeaderNameKey, name); | 265 header->SetString(keys::kHeaderNameKey, name); |
| 266 if (IsStringUTF8(value)) { | 266 if (IsStringUTF8(value)) { |
| 267 header->SetString(keys::kHeaderValueKey, value); | 267 header->SetString(keys::kHeaderValueKey, value); |
| 268 } else { | 268 } else { |
| 269 header->Set(keys::kHeaderBinaryValueKey, | 269 header->Set(keys::kHeaderBinaryValueKey, |
| 270 helpers::StringToCharList(value)); | 270 helpers::StringToCharList(value)); |
| 271 } | 271 } |
| 272 return header; | 272 return header; |
| 273 } | 273 } |
| 274 | 274 |
| 275 // Creates a list of HttpHeaders (see extension_api.json). If |headers| is | 275 // Creates a list of HttpHeaders (see the extension API JSON). If |headers| is |
| 276 // NULL, the list is empty. Ownership is passed to the caller. | 276 // NULL, the list is empty. Ownership is passed to the caller. |
| 277 ListValue* GetResponseHeadersList(const net::HttpResponseHeaders* headers) { | 277 ListValue* GetResponseHeadersList(const net::HttpResponseHeaders* headers) { |
| 278 ListValue* headers_value = new ListValue(); | 278 ListValue* headers_value = new ListValue(); |
| 279 if (headers) { | 279 if (headers) { |
| 280 void* iter = NULL; | 280 void* iter = NULL; |
| 281 std::string name; | 281 std::string name; |
| 282 std::string value; | 282 std::string value; |
| 283 while (headers->EnumerateHeaderLines(&iter, &name, &value)) | 283 while (headers->EnumerateHeaderLines(&iter, &name, &value)) |
| 284 headers_value->Append(ToHeaderDictionary(name, value)); | 284 headers_value->Append(ToHeaderDictionary(name, value)); |
| 285 } | 285 } |
| (...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 1707 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
| 1708 adblock = true; | 1708 adblock = true; |
| 1709 } else { | 1709 } else { |
| 1710 other = true; | 1710 other = true; |
| 1711 } | 1711 } |
| 1712 } | 1712 } |
| 1713 } | 1713 } |
| 1714 | 1714 |
| 1715 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 1715 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
| 1716 } | 1716 } |
| OLD | NEW |