OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/permissions/socket_permission_entry.h" | 5 #include "extensions/common/permissions/socket_permission_entry.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <sstream> | 8 #include <sstream> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 std::vector<std::string> host_components; | 171 std::vector<std::string> host_components; |
172 base::SplitString(result.pattern_.host, kDot, &host_components); | 172 base::SplitString(result.pattern_.host, kDot, &host_components); |
173 DCHECK(!host_components.empty()); | 173 DCHECK(!host_components.empty()); |
174 | 174 |
175 if (host_components[0] == kWildcard || host_components[0].empty()) { | 175 if (host_components[0] == kWildcard || host_components[0].empty()) { |
176 host_components.erase(host_components.begin(), | 176 host_components.erase(host_components.begin(), |
177 host_components.begin() + 1); | 177 host_components.begin() + 1); |
178 } else { | 178 } else { |
179 result.match_subdomains_ = false; | 179 result.match_subdomains_ = false; |
180 } | 180 } |
181 result.pattern_.host = JoinString(host_components, kDot); | 181 result.pattern_.host = base::JoinString(host_components, "."); |
182 } | 182 } |
183 | 183 |
184 if (pattern_tokens.size() == 1 || pattern_tokens[1].empty() || | 184 if (pattern_tokens.size() == 1 || pattern_tokens[1].empty() || |
185 pattern_tokens[1] == kWildcard) { | 185 pattern_tokens[1] == kWildcard) { |
186 *entry = result; | 186 *entry = result; |
187 return true; | 187 return true; |
188 } | 188 } |
189 | 189 |
190 if (StartsOrEndsWithWhitespace(pattern_tokens[1])) | 190 if (StartsOrEndsWithWhitespace(pattern_tokens[1])) |
191 return false; | 191 return false; |
(...skipping 23 matching lines...) Expand all Loading... |
215 | 215 |
216 if (pattern_.port == kWildcardPortNumber) | 216 if (pattern_.port == kWildcardPortNumber) |
217 result.append(1, kColon).append(kWildcard); | 217 result.append(1, kColon).append(kWildcard); |
218 else | 218 else |
219 result.append(1, kColon).append(base::IntToString(pattern_.port)); | 219 result.append(1, kColon).append(base::IntToString(pattern_.port)); |
220 | 220 |
221 return result; | 221 return result; |
222 } | 222 } |
223 | 223 |
224 } // namespace extensions | 224 } // namespace extensions |
OLD | NEW |