| Index: chrome/common/extensions/url_pattern.cc
|
| diff --git a/chrome/common/extensions/url_pattern.cc b/chrome/common/extensions/url_pattern.cc
|
| index 979d14b6b3ae4270b7419d85922318d0ec3d26cd..70240b48bd67e53e87f4b399391cb6f564a94042 100644
|
| --- a/chrome/common/extensions/url_pattern.cc
|
| +++ b/chrome/common/extensions/url_pattern.cc
|
| @@ -76,7 +76,7 @@ bool URLPattern::Parse(const std::string& pattern) {
|
|
|
| // File URLs are special because they have no host. There are other schemes
|
| // with the same structure, but we don't support them (yet).
|
| - if (scheme_ == "file") {
|
| + if (scheme_ == chrome::kFileScheme) {
|
| path_start_pos = host_start_pos;
|
| } else {
|
| size_t host_end_pos = pattern.find(kPathSeparator, host_start_pos);
|
| @@ -206,15 +206,17 @@ std::string URLPattern::GetAsString() const {
|
|
|
| std::string spec = scheme_ + chrome::kStandardSchemeSeparator;
|
|
|
| - if (match_subdomains_) {
|
| - spec += "*";
|
| + if (scheme_ != chrome::kFileScheme) {
|
| + if (match_subdomains_) {
|
| + spec += "*";
|
| + if (!host_.empty())
|
| + spec += ".";
|
| + }
|
| +
|
| if (!host_.empty())
|
| - spec += ".";
|
| + spec += host_;
|
| }
|
|
|
| - if (!host_.empty())
|
| - spec += host_;
|
| -
|
| if (!path_.empty())
|
| spec += path_;
|
|
|
| @@ -242,3 +244,23 @@ bool URLPattern::OverlapsWith(const URLPattern& other) const {
|
|
|
| return true;
|
| }
|
| +
|
| +std::vector<URLPattern> URLPattern::ConvertToExplicitSchemes() const {
|
| + std::vector<URLPattern> result;
|
| +
|
| + if (scheme_ != "*" && !match_all_urls_) {
|
| + result.push_back(*this);
|
| + return result;
|
| + }
|
| +
|
| + for (size_t i = 0; i < arraysize(kValidSchemes); ++i) {
|
| + if (MatchesScheme(kValidSchemes[i])) {
|
| + URLPattern temp = *this;
|
| + temp.SetScheme(kValidSchemes[i]);
|
| + temp.set_match_all_urls(false);
|
| + result.push_back(temp);
|
| + }
|
| + }
|
| +
|
| + return result;
|
| +}
|
|
|