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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 } | 141 } |
142 | 142 |
143 bool URLPattern::operator>(const URLPattern& other) const { | 143 bool URLPattern::operator>(const URLPattern& other) const { |
144 return GetAsString() > other.GetAsString(); | 144 return GetAsString() > other.GetAsString(); |
145 } | 145 } |
146 | 146 |
147 bool URLPattern::operator==(const URLPattern& other) const { | 147 bool URLPattern::operator==(const URLPattern& other) const { |
148 return GetAsString() == other.GetAsString(); | 148 return GetAsString() == other.GetAsString(); |
149 } | 149 } |
150 | 150 |
151 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern) { | |
152 return out << '"' << url_pattern.GetAsString() << '"'; | |
Jeffrey Yasskin
2014/05/28 21:06:08
Similarly, #include <ostream> for this.
aboxhall
2014/05/28 22:06:44
Done.
| |
153 } | |
154 | |
151 URLPattern::ParseResult URLPattern::Parse(const std::string& pattern) { | 155 URLPattern::ParseResult URLPattern::Parse(const std::string& pattern) { |
152 spec_.clear(); | 156 spec_.clear(); |
153 SetMatchAllURLs(false); | 157 SetMatchAllURLs(false); |
154 SetMatchSubdomains(false); | 158 SetMatchSubdomains(false); |
155 SetPort("*"); | 159 SetPort("*"); |
156 | 160 |
157 // Special case pattern to match every valid URL. | 161 // Special case pattern to match every valid URL. |
158 if (pattern == kAllUrlsPattern) { | 162 if (pattern == kAllUrlsPattern) { |
159 SetMatchAllURLs(true); | 163 SetMatchAllURLs(true); |
160 return PARSE_SUCCESS; | 164 return PARSE_SUCCESS; |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 } | 540 } |
537 | 541 |
538 return result; | 542 return result; |
539 } | 543 } |
540 | 544 |
541 // static | 545 // static |
542 const char* URLPattern::GetParseResultString( | 546 const char* URLPattern::GetParseResultString( |
543 URLPattern::ParseResult parse_result) { | 547 URLPattern::ParseResult parse_result) { |
544 return kParseResultMessages[parse_result]; | 548 return kParseResultMessages[parse_result]; |
545 } | 549 } |
OLD | NEW |