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 "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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 bool IsStandardScheme(const std::string& scheme) { | 70 bool IsStandardScheme(const std::string& scheme) { |
71 // "*" gets the same treatment as a standard scheme. | 71 // "*" gets the same treatment as a standard scheme. |
72 if (scheme == "*") | 72 if (scheme == "*") |
73 return true; | 73 return true; |
74 | 74 |
75 return url_util::IsStandard(scheme.c_str(), | 75 return url_util::IsStandard(scheme.c_str(), |
76 url_parse::Component(0, static_cast<int>(scheme.length()))); | 76 url_parse::Component(0, static_cast<int>(scheme.length()))); |
77 } | 77 } |
78 | 78 |
79 bool IsValidPortForScheme(const std::string scheme, const std::string& port) { | 79 bool IsValidPortForScheme(const std::string& scheme, const std::string& port) { |
80 if (port == "*") | 80 if (port == "*") |
81 return true; | 81 return true; |
82 | 82 |
83 // Only accept non-wildcard ports if the scheme uses ports. | 83 // Only accept non-wildcard ports if the scheme uses ports. |
84 if (url_canon::DefaultPortForScheme(scheme.c_str(), scheme.length()) == | 84 if (url_canon::DefaultPortForScheme(scheme.c_str(), scheme.length()) == |
85 url_parse::PORT_UNSPECIFIED) { | 85 url_parse::PORT_UNSPECIFIED) { |
86 return false; | 86 return false; |
87 } | 87 } |
88 | 88 |
89 int parsed_port = url_parse::PORT_UNSPECIFIED; | 89 int parsed_port = url_parse::PORT_UNSPECIFIED; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 514 } |
515 | 515 |
516 return result; | 516 return result; |
517 } | 517 } |
518 | 518 |
519 // static | 519 // static |
520 const char* URLPattern::GetParseResultString( | 520 const char* URLPattern::GetParseResultString( |
521 URLPattern::ParseResult parse_result) { | 521 URLPattern::ParseResult parse_result) { |
522 return kParseResultMessages[parse_result]; | 522 return kParseResultMessages[parse_result]; |
523 } | 523 } |
OLD | NEW |