| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 bool ExtensionWebRequestEventRouter::RequestFilter::InitFromValue( | 413 bool ExtensionWebRequestEventRouter::RequestFilter::InitFromValue( |
| 414 const DictionaryValue& value, std::string* error) { | 414 const DictionaryValue& value, std::string* error) { |
| 415 for (DictionaryValue::key_iterator key = value.begin_keys(); | 415 for (DictionaryValue::key_iterator key = value.begin_keys(); |
| 416 key != value.end_keys(); ++key) { | 416 key != value.end_keys(); ++key) { |
| 417 if (*key == "urls") { | 417 if (*key == "urls") { |
| 418 ListValue* urls_value = NULL; | 418 ListValue* urls_value = NULL; |
| 419 if (!value.GetList("urls", &urls_value)) | 419 if (!value.GetList("urls", &urls_value)) |
| 420 return false; | 420 return false; |
| 421 for (size_t i = 0; i < urls_value->GetSize(); ++i) { | 421 for (size_t i = 0; i < urls_value->GetSize(); ++i) { |
| 422 std::string url; | 422 std::string url; |
| 423 URLPattern pattern(URLPattern::SCHEME_ALL); | 423 URLPattern pattern(URLPattern::ERROR_ON_PORTS, URLPattern::SCHEME_ALL); |
| 424 if (!urls_value->GetString(i, &url) || | 424 if (!urls_value->GetString(i, &url) || |
| 425 pattern.Parse(url, URLPattern::ERROR_ON_PORTS) != | 425 pattern.Parse(url) != URLPattern::PARSE_SUCCESS) { |
| 426 URLPattern::PARSE_SUCCESS) { | |
| 427 *error = ExtensionErrorUtils::FormatErrorMessage( | 426 *error = ExtensionErrorUtils::FormatErrorMessage( |
| 428 keys::kInvalidRequestFilterUrl, url); | 427 keys::kInvalidRequestFilterUrl, url); |
| 429 return false; | 428 return false; |
| 430 } | 429 } |
| 431 urls.AddPattern(pattern); | 430 urls.AddPattern(pattern); |
| 432 } | 431 } |
| 433 } else if (*key == "types") { | 432 } else if (*key == "types") { |
| 434 ListValue* types_value = NULL; | 433 ListValue* types_value = NULL; |
| 435 if (!value.GetList("types", &types_value)) | 434 if (!value.GetList("types", &types_value)) |
| 436 return false; | 435 return false; |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 1706 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
| 1708 adblock = true; | 1707 adblock = true; |
| 1709 } else { | 1708 } else { |
| 1710 other = true; | 1709 other = true; |
| 1711 } | 1710 } |
| 1712 } | 1711 } |
| 1713 } | 1712 } |
| 1714 | 1713 |
| 1715 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 1714 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
| 1716 } | 1715 } |
| OLD | NEW |