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.h" | 5 #include "extensions/browser/api/web_request/web_request_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 if (!value.HasKey("urls")) | 473 if (!value.HasKey("urls")) |
474 return false; | 474 return false; |
475 | 475 |
476 for (base::DictionaryValue::Iterator it(value); !it.IsAtEnd(); it.Advance()) { | 476 for (base::DictionaryValue::Iterator it(value); !it.IsAtEnd(); it.Advance()) { |
477 if (it.key() == "urls") { | 477 if (it.key() == "urls") { |
478 const base::ListValue* urls_value = NULL; | 478 const base::ListValue* urls_value = NULL; |
479 if (!it.value().GetAsList(&urls_value)) | 479 if (!it.value().GetAsList(&urls_value)) |
480 return false; | 480 return false; |
481 for (size_t i = 0; i < urls_value->GetSize(); ++i) { | 481 for (size_t i = 0; i < urls_value->GetSize(); ++i) { |
482 std::string url; | 482 std::string url; |
483 URLPattern pattern( | 483 URLPattern pattern(URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS | |
484 URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS | | 484 URLPattern::SCHEME_FTP | URLPattern::SCHEME_FILE | |
485 URLPattern::SCHEME_FTP | URLPattern::SCHEME_FILE | | 485 URLPattern::SCHEME_EXTENSION | |
486 URLPattern::SCHEME_EXTENSION); | 486 URLPattern::SCHEME_WS | URLPattern::SCHEME_WSS); |
487 if (!urls_value->GetString(i, &url) || | 487 if (!urls_value->GetString(i, &url) || |
488 pattern.Parse(url) != URLPattern::PARSE_SUCCESS) { | 488 pattern.Parse(url) != URLPattern::PARSE_SUCCESS) { |
489 *error = ErrorUtils::FormatErrorMessage( | 489 *error = ErrorUtils::FormatErrorMessage( |
490 keys::kInvalidRequestFilterUrl, url); | 490 keys::kInvalidRequestFilterUrl, url); |
491 return false; | 491 return false; |
492 } | 492 } |
493 urls.AddPattern(pattern); | 493 urls.AddPattern(pattern); |
494 } | 494 } |
495 } else if (it.key() == "types") { | 495 } else if (it.key() == "types") { |
496 const base::ListValue* types_value = NULL; | 496 const base::ListValue* types_value = NULL; |
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 // Since EventListeners are segmented by browser_context, check that | 2354 // Since EventListeners are segmented by browser_context, check that |
2355 // last, as it is exceedingly unlikely to be different. | 2355 // last, as it is exceedingly unlikely to be different. |
2356 return extension_id == that.extension_id && | 2356 return extension_id == that.extension_id && |
2357 sub_event_name == that.sub_event_name && | 2357 sub_event_name == that.sub_event_name && |
2358 web_view_instance_id == that.web_view_instance_id && | 2358 web_view_instance_id == that.web_view_instance_id && |
2359 embedder_process_id == that.embedder_process_id && | 2359 embedder_process_id == that.embedder_process_id && |
2360 browser_context == that.browser_context; | 2360 browser_context == that.browser_context; |
2361 } | 2361 } |
2362 | 2362 |
2363 } // namespace extensions | 2363 } // namespace extensions |
OLD | NEW |