| 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/content_settings_pattern_parser.h" | 5 #include "chrome/common/content_settings_pattern_parser.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "extensions/common/constants.h" | 9 #include "extensions/common/constants.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 std::string PatternParser::ToString( | 191 std::string PatternParser::ToString( |
| 192 const ContentSettingsPattern::PatternParts& parts) { | 192 const ContentSettingsPattern::PatternParts& parts) { |
| 193 // Return the most compact form to support legacy code and legacy pattern | 193 // Return the most compact form to support legacy code and legacy pattern |
| 194 // strings. | 194 // strings. |
| 195 if (parts.is_scheme_wildcard && | 195 if (parts.is_scheme_wildcard && |
| 196 parts.has_domain_wildcard && | 196 parts.has_domain_wildcard && |
| 197 parts.host.empty() && | 197 parts.host.empty() && |
| 198 parts.is_port_wildcard) | 198 parts.is_port_wildcard) |
| 199 return "*"; | 199 return "*"; |
| 200 | 200 |
| 201 std::string str = ""; | 201 std::string str; |
| 202 if (!parts.is_scheme_wildcard) | 202 if (!parts.is_scheme_wildcard) |
| 203 str += parts.scheme + content::kStandardSchemeSeparator; | 203 str += parts.scheme + content::kStandardSchemeSeparator; |
| 204 | 204 |
| 205 if (parts.scheme == chrome::kFileScheme) { | 205 if (parts.scheme == chrome::kFileScheme) { |
| 206 if (parts.is_path_wildcard) | 206 if (parts.is_path_wildcard) |
| 207 return str + kUrlPathSeparator + kPathWildcard; | 207 return str + kUrlPathSeparator + kPathWildcard; |
| 208 else | 208 else |
| 209 return str + parts.path; | 209 return str + parts.path; |
| 210 } | 210 } |
| 211 | 211 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 223 } | 223 } |
| 224 | 224 |
| 225 if (!parts.is_port_wildcard) { | 225 if (!parts.is_port_wildcard) { |
| 226 str += std::string(kUrlPortSeparator) + parts.port; | 226 str += std::string(kUrlPortSeparator) + parts.port; |
| 227 } | 227 } |
| 228 | 228 |
| 229 return str; | 229 return str; |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace content_settings | 232 } // namespace content_settings |
| OLD | NEW |