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/pattern.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 // Could be empty if the host only consists of whitespace characters. | 243 // Could be empty if the host only consists of whitespace characters. |
244 if (host_components.empty()) | 244 if (host_components.empty()) |
245 return PARSE_ERROR_EMPTY_HOST; | 245 return PARSE_ERROR_EMPTY_HOST; |
246 | 246 |
247 if (host_components[0] == "*") { | 247 if (host_components[0] == "*") { |
248 match_subdomains_ = true; | 248 match_subdomains_ = true; |
249 host_components.erase(host_components.begin(), | 249 host_components.erase(host_components.begin(), |
250 host_components.begin() + 1); | 250 host_components.begin() + 1); |
251 } | 251 } |
252 host_ = JoinString(host_components, '.'); | 252 host_ = base::JoinString(host_components, "."); |
253 | 253 |
254 path_start_pos = host_end_pos; | 254 path_start_pos = host_end_pos; |
255 } | 255 } |
256 | 256 |
257 SetPath(pattern.substr(path_start_pos)); | 257 SetPath(pattern.substr(path_start_pos)); |
258 | 258 |
259 size_t port_pos = host_.find(':'); | 259 size_t port_pos = host_.find(':'); |
260 if (port_pos != std::string::npos) { | 260 if (port_pos != std::string::npos) { |
261 if (!SetPort(host_.substr(port_pos + 1))) | 261 if (!SetPort(host_.substr(port_pos + 1))) |
262 return PARSE_ERROR_INVALID_PORT; | 262 return PARSE_ERROR_INVALID_PORT; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 } | 606 } |
607 | 607 |
608 return result; | 608 return result; |
609 } | 609 } |
610 | 610 |
611 // static | 611 // static |
612 const char* URLPattern::GetParseResultString( | 612 const char* URLPattern::GetParseResultString( |
613 URLPattern::ParseResult parse_result) { | 613 URLPattern::ParseResult parse_result) { |
614 return kParseResultMessages[parse_result]; | 614 return kParseResultMessages[parse_result]; |
615 } | 615 } |
OLD | NEW |