| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/permissions/socket_permission_entry.h" | 5 #include "chrome/common/extensions/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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 using content::SocketPermissionRequest; | 22 using content::SocketPermissionRequest; |
| 23 | 23 |
| 24 const char kColon = ':'; | 24 const char kColon = ':'; |
| 25 const char kDot = '.'; | 25 const char kDot = '.'; |
| 26 const char kWildcard[] = "*"; | 26 const char kWildcard[] = "*"; |
| 27 const int kWildcardPortNumber = 0; | 27 const int kWildcardPortNumber = 0; |
| 28 const int kInvalidPort = -1; | 28 const int kInvalidPort = -1; |
| 29 | 29 |
| 30 bool StartsOrEndsWithWhitespace(const std::string& str) { | 30 bool StartsOrEndsWithWhitespace(const std::string& str) { |
| 31 if (str.find_first_not_of(kWhitespaceASCII) != 0) | 31 if (str.find_first_not_of(base::kWhitespaceASCII) != 0) |
| 32 return true; | 32 return true; |
| 33 if (str.find_last_not_of(kWhitespaceASCII) != str.length() - 1) | 33 if (str.find_last_not_of(base::kWhitespaceASCII) != str.length() - 1) |
| 34 return true; | 34 return true; |
| 35 return false; | 35 return false; |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 namespace extensions { | 40 namespace extensions { |
| 41 | 41 |
| 42 SocketPermissionEntry::SocketPermissionEntry() | 42 SocketPermissionEntry::SocketPermissionEntry() |
| 43 : pattern_(SocketPermissionRequest::NONE, std::string(), kInvalidPort), | 43 : pattern_(SocketPermissionRequest::NONE, std::string(), kInvalidPort), |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 if (pattern_.port == kWildcardPortNumber) | 219 if (pattern_.port == kWildcardPortNumber) |
| 220 result.append(1, kColon).append(kWildcard); | 220 result.append(1, kColon).append(kWildcard); |
| 221 else | 221 else |
| 222 result.append(1, kColon).append(base::IntToString(pattern_.port)); | 222 result.append(1, kColon).append(base::IntToString(pattern_.port)); |
| 223 | 223 |
| 224 return result; | 224 return result; |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace extensions | 227 } // namespace extensions |
| OLD | NEW |