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 "chrome/browser/extensions/api/web_request/web_request_api.h" | 5 #include "chrome/browser/extensions/api/web_request/web_request_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/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 295 } |
296 return true; | 296 return true; |
297 } | 297 } |
298 | 298 |
299 // Converts the |name|, |value| pair of a http header to a HttpHeaders | 299 // Converts the |name|, |value| pair of a http header to a HttpHeaders |
300 // dictionary. Ownership is passed to the caller. | 300 // dictionary. Ownership is passed to the caller. |
301 base::DictionaryValue* ToHeaderDictionary(const std::string& name, | 301 base::DictionaryValue* ToHeaderDictionary(const std::string& name, |
302 const std::string& value) { | 302 const std::string& value) { |
303 base::DictionaryValue* header = new base::DictionaryValue(); | 303 base::DictionaryValue* header = new base::DictionaryValue(); |
304 header->SetString(keys::kHeaderNameKey, name); | 304 header->SetString(keys::kHeaderNameKey, name); |
305 if (IsStringUTF8(value)) { | 305 if (base::IsStringUTF8(value)) { |
306 header->SetString(keys::kHeaderValueKey, value); | 306 header->SetString(keys::kHeaderValueKey, value); |
307 } else { | 307 } else { |
308 header->Set(keys::kHeaderBinaryValueKey, | 308 header->Set(keys::kHeaderBinaryValueKey, |
309 helpers::StringToCharList(value)); | 309 helpers::StringToCharList(value)); |
310 } | 310 } |
311 return header; | 311 return header; |
312 } | 312 } |
313 | 313 |
314 // Creates a list of HttpHeaders (see the extension API JSON). If |headers| is | 314 // Creates a list of HttpHeaders (see the extension API JSON). If |headers| is |
315 // NULL, the list is empty. Ownership is passed to the caller. | 315 // NULL, the list is empty. Ownership is passed to the caller. |
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 2445 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
2446 adblock = true; | 2446 adblock = true; |
2447 } else { | 2447 } else { |
2448 other = true; | 2448 other = true; |
2449 } | 2449 } |
2450 } | 2450 } |
2451 } | 2451 } |
2452 | 2452 |
2453 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 2453 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
2454 } | 2454 } |
OLD | NEW |