| 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 "components/autofill/core/browser/validation.h" | 5 #include "components/autofill/core/browser/validation.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // | 175 // |
| 176 // References for current practices: | 176 // References for current practices: |
| 177 // http://www.socialsecurity.gov/employer/randomization.html | 177 // http://www.socialsecurity.gov/employer/randomization.html |
| 178 // http://www.socialsecurity.gov/employer/randomizationfaqs.html | 178 // http://www.socialsecurity.gov/employer/randomizationfaqs.html |
| 179 // | 179 // |
| 180 // References for historic practices: | 180 // References for historic practices: |
| 181 // http://www.socialsecurity.gov/history/ssn/geocard.html | 181 // http://www.socialsecurity.gov/history/ssn/geocard.html |
| 182 // http://www.socialsecurity.gov/employer/stateweb.htm | 182 // http://www.socialsecurity.gov/employer/stateweb.htm |
| 183 // http://www.socialsecurity.gov/employer/ssnvhighgroup.htm | 183 // http://www.socialsecurity.gov/employer/ssnvhighgroup.htm |
| 184 | 184 |
| 185 if (number_string.length() != 9 || !IsStringASCII(number_string)) | 185 if (number_string.length() != 9 || !base::IsStringASCII(number_string)) |
| 186 return false; | 186 return false; |
| 187 | 187 |
| 188 int area; | 188 int area; |
| 189 if (!base::StringToInt(StringPiece16(number_string.begin(), | 189 if (!base::StringToInt(StringPiece16(number_string.begin(), |
| 190 number_string.begin() + 3), | 190 number_string.begin() + 3), |
| 191 &area)) { | 191 &area)) { |
| 192 return false; | 192 return false; |
| 193 } | 193 } |
| 194 if (area < 1 || | 194 if (area < 1 || |
| 195 area == 666 || | 195 area == 666 || |
| (...skipping 14 matching lines...) Expand all Loading... |
| 210 number_string.begin() + 9), | 210 number_string.begin() + 9), |
| 211 &serial) | 211 &serial) |
| 212 || serial == 0) { | 212 || serial == 0) { |
| 213 return false; | 213 return false; |
| 214 } | 214 } |
| 215 | 215 |
| 216 return true; | 216 return true; |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace autofill | 219 } // namespace autofill |
| OLD | NEW |