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