Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/common/extensions/url_pattern.h" | 5 #include "chrome/common/extensions/url_pattern.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 bool URLPattern::operator<(const URLPattern& other) const { | 123 bool URLPattern::operator<(const URLPattern& other) const { |
| 124 return GetAsString() < other.GetAsString(); | 124 return GetAsString() < other.GetAsString(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool URLPattern::operator==(const URLPattern& other) const { | 127 bool URLPattern::operator==(const URLPattern& other) const { |
| 128 return GetAsString() == other.GetAsString(); | 128 return GetAsString() == other.GetAsString(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 URLPattern::ParseResult URLPattern::Parse(const std::string& pattern) { | 131 URLPattern::ParseResult URLPattern::Parse(const std::string& pattern) { |
| 132 spec_.clear(); | 132 spec_.clear(); |
| 133 SetMatchAllURLs(false); | |
| 134 SetMatchSubdomains(false); | |
| 135 SetPort("*"); | |
|
groby-ooo-7-16
2012/02/14 00:14:30
Why are we setting those here? Isn't that covered
Greg Billock
2012/02/14 01:21:46
This is actually in another CL that has gone in al
| |
| 133 | 136 |
| 134 // Special case pattern to match every valid URL. | 137 // Special case pattern to match every valid URL. |
| 135 if (pattern == kAllUrlsPattern) { | 138 if (pattern == kAllUrlsPattern) { |
| 136 SetMatchAllURLs(true); | 139 SetMatchAllURLs(true); |
| 137 return PARSE_SUCCESS; | 140 return PARSE_SUCCESS; |
| 138 } | 141 } |
| 139 | 142 |
| 140 // Parse out the scheme. | 143 // Parse out the scheme. |
| 141 size_t scheme_end_pos = pattern.find(chrome::kStandardSchemeSeparator); | 144 size_t scheme_end_pos = pattern.find(chrome::kStandardSchemeSeparator); |
| 142 bool has_standard_scheme_separator = true; | 145 bool has_standard_scheme_separator = true; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 } | 492 } |
| 490 | 493 |
| 491 return result; | 494 return result; |
| 492 } | 495 } |
| 493 | 496 |
| 494 // static | 497 // static |
| 495 const char* URLPattern::GetParseResultString( | 498 const char* URLPattern::GetParseResultString( |
| 496 URLPattern::ParseResult parse_result) { | 499 URLPattern::ParseResult parse_result) { |
| 497 return kParseResultMessages[parse_result]; | 500 return kParseResultMessages[parse_result]; |
| 498 } | 501 } |
| OLD | NEW |