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/pattern.h" |
9 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
11 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
14 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
15 #include "extensions/common/constants.h" | 16 #include "extensions/common/constants.h" |
16 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 17 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 #include "url/url_util.h" | 19 #include "url/url_util.h" |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 // defaults to *. It's not very interesting anyway, so leave it out. | 472 // defaults to *. It's not very interesting anyway, so leave it out. |
472 return !ImpliesAllHosts() && scheme_ != "*" && !match_subdomains_; | 473 return !ImpliesAllHosts() && scheme_ != "*" && !match_subdomains_; |
473 } | 474 } |
474 | 475 |
475 bool URLPattern::MatchesPath(const std::string& test) const { | 476 bool URLPattern::MatchesPath(const std::string& test) const { |
476 // Make the behaviour of OverlapsWith consistent with MatchesURL, which is | 477 // Make the behaviour of OverlapsWith consistent with MatchesURL, which is |
477 // need to match hosted apps on e.g. 'google.com' also run on 'google.com/'. | 478 // need to match hosted apps on e.g. 'google.com' also run on 'google.com/'. |
478 if (test + "/*" == path_escaped_) | 479 if (test + "/*" == path_escaped_) |
479 return true; | 480 return true; |
480 | 481 |
481 return MatchPattern(test, path_escaped_); | 482 return base::MatchPattern(test, path_escaped_); |
482 } | 483 } |
483 | 484 |
484 const std::string& URLPattern::GetAsString() const { | 485 const std::string& URLPattern::GetAsString() const { |
485 if (!spec_.empty()) | 486 if (!spec_.empty()) |
486 return spec_; | 487 return spec_; |
487 | 488 |
488 if (match_all_urls_) { | 489 if (match_all_urls_) { |
489 spec_ = kAllUrlsPattern; | 490 spec_ = kAllUrlsPattern; |
490 return spec_; | 491 return spec_; |
491 } | 492 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 } | 606 } |
606 | 607 |
607 return result; | 608 return result; |
608 } | 609 } |
609 | 610 |
610 // static | 611 // static |
611 const char* URLPattern::GetParseResultString( | 612 const char* URLPattern::GetParseResultString( |
612 URLPattern::ParseResult parse_result) { | 613 URLPattern::ParseResult parse_result) { |
613 return kParseResultMessages[parse_result]; | 614 return kParseResultMessages[parse_result]; |
614 } | 615 } |
OLD | NEW |