| 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 "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 return true; | 454 return true; |
| 455 return (MatchesAnyScheme(other.GetExplicitSchemes()) || | 455 return (MatchesAnyScheme(other.GetExplicitSchemes()) || |
| 456 other.MatchesAnyScheme(GetExplicitSchemes())) | 456 other.MatchesAnyScheme(GetExplicitSchemes())) |
| 457 && (MatchesHost(other.host()) || other.MatchesHost(host())) | 457 && (MatchesHost(other.host()) || other.MatchesHost(host())) |
| 458 && (MatchesPortPattern(other.port()) || other.MatchesPortPattern(port())) | 458 && (MatchesPortPattern(other.port()) || other.MatchesPortPattern(port())) |
| 459 && (MatchesPath(StripTrailingWildcard(other.path())) || | 459 && (MatchesPath(StripTrailingWildcard(other.path())) || |
| 460 other.MatchesPath(StripTrailingWildcard(path()))); | 460 other.MatchesPath(StripTrailingWildcard(path()))); |
| 461 } | 461 } |
| 462 | 462 |
| 463 bool URLPattern::Contains(const URLPattern& other) const { | 463 bool URLPattern::Contains(const URLPattern& other) const { |
| 464 if (*this == other) |
| 465 return true; |
| 464 if (match_all_urls()) | 466 if (match_all_urls()) |
| 465 return true; | 467 return true; |
| 466 return MatchesAllSchemes(other.GetExplicitSchemes()) | 468 return MatchesAllSchemes(other.GetExplicitSchemes()) |
| 467 && MatchesHost(other.host()) | 469 && MatchesHost(other.host()) |
| 468 && MatchesPortPattern(other.port()) | 470 && MatchesPortPattern(other.port()) |
| 469 && MatchesPath(StripTrailingWildcard(other.path())); | 471 && MatchesPath(StripTrailingWildcard(other.path())); |
| 470 } | 472 } |
| 471 | 473 |
| 472 bool URLPattern::MatchesAnyScheme( | 474 bool URLPattern::MatchesAnyScheme( |
| 473 const std::vector<std::string>& schemes) const { | 475 const std::vector<std::string>& schemes) const { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 } | 538 } |
| 537 | 539 |
| 538 return result; | 540 return result; |
| 539 } | 541 } |
| 540 | 542 |
| 541 // static | 543 // static |
| 542 const char* URLPattern::GetParseResultString( | 544 const char* URLPattern::GetParseResultString( |
| 543 URLPattern::ParseResult parse_result) { | 545 URLPattern::ParseResult parse_result) { |
| 544 return kParseResultMessages[parse_result]; | 546 return kParseResultMessages[parse_result]; |
| 545 } | 547 } |
| OLD | NEW |