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/common/url_pattern.h" | 5 #include "extensions/common/url_pattern.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 // unrecognized, or the length of the recognized TLD. | 459 // unrecognized, or the length of the recognized TLD. |
460 registry_length = net::registry_controlled_domains::GetRegistryLength( | 460 registry_length = net::registry_controlled_domains::GetRegistryLength( |
461 base::StringPrintf("foo.%s", host_.c_str()), | 461 base::StringPrintf("foo.%s", host_.c_str()), |
462 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | 462 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
463 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 463 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
464 // If we recognized this TLD, then this is a pattern like *.com, and it | 464 // If we recognized this TLD, then this is a pattern like *.com, and it |
465 // should imply all hosts. Otherwise, this doesn't imply all hosts. | 465 // should imply all hosts. Otherwise, this doesn't imply all hosts. |
466 return registry_length > 0; | 466 return registry_length > 0; |
467 } | 467 } |
468 | 468 |
469 bool URLPattern::MatchesSingleOrigin() const { | |
470 return scheme_ != "*" && !ImpliesAllHosts() && !match_subdomains_; | |
not at google - send to devlin
2014/08/12 19:49:27
you should check the port here as well.
and as a
gpdavis
2014/08/12 21:19:55
When I test this out (logging the visible url's po
not at google - send to devlin
2014/08/12 23:13:18
Ah ok. Yeah, forget about port, whatever. Just com
gpdavis
2014/08/13 00:08:24
Done.
| |
471 } | |
472 | |
469 bool URLPattern::MatchesPath(const std::string& test) const { | 473 bool URLPattern::MatchesPath(const std::string& test) const { |
470 // Make the behaviour of OverlapsWith consistent with MatchesURL, which is | 474 // Make the behaviour of OverlapsWith consistent with MatchesURL, which is |
471 // need to match hosted apps on e.g. 'google.com' also run on 'google.com/'. | 475 // need to match hosted apps on e.g. 'google.com' also run on 'google.com/'. |
472 if (test + "/*" == path_escaped_) | 476 if (test + "/*" == path_escaped_) |
473 return true; | 477 return true; |
474 | 478 |
475 return MatchPattern(test, path_escaped_); | 479 return MatchPattern(test, path_escaped_); |
476 } | 480 } |
477 | 481 |
478 const std::string& URLPattern::GetAsString() const { | 482 const std::string& URLPattern::GetAsString() const { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 } | 603 } |
600 | 604 |
601 return result; | 605 return result; |
602 } | 606 } |
603 | 607 |
604 // static | 608 // static |
605 const char* URLPattern::GetParseResultString( | 609 const char* URLPattern::GetParseResultString( |
606 URLPattern::ParseResult parse_result) { | 610 URLPattern::ParseResult parse_result) { |
607 return kParseResultMessages[parse_result]; | 611 return kParseResultMessages[parse_result]; |
608 } | 612 } |
OLD | NEW |