| 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 "components/password_manager/core/browser/import/csv_reader.h" | 5 #include "components/password_manager/core/browser/import/csv_reader.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" |
| 8 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 9 #include "third_party/re2/src/re2/re2.h" | 12 #include "third_party/re2/src/re2/re2.h" |
| 10 | 13 |
| 11 namespace { | 14 namespace { |
| 12 | 15 |
| 13 // Regular expression that matches and captures the first row in CSV formatted | 16 // Regular expression that matches and captures the first row in CSV formatted |
| 14 // data (i.e., until the first newline that is not enclosed in double quotes). | 17 // data (i.e., until the first newline that is not enclosed in double quotes). |
| 15 // Will throw away the potential trailing EOL character (which is expected to | 18 // Will throw away the potential trailing EOL character (which is expected to |
| 16 // have already been normalized to a single '\n'). | 19 // have already been normalized to a single '\n'). |
| 17 const char kFirstRowRE[] = | 20 const char kFirstRowRE[] = |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 records->resize(records->size() + 1); | 124 records->resize(records->size() + 1); |
| 122 for (size_t i = 0; i < column_names->size() && i < fields.size(); ++i) { | 125 for (size_t i = 0; i < column_names->size() && i < fields.size(); ++i) { |
| 123 records->back()[(*column_names)[i]].swap(fields[i]); | 126 records->back()[(*column_names)[i]].swap(fields[i]); |
| 124 } | 127 } |
| 125 } | 128 } |
| 126 | 129 |
| 127 return true; | 130 return true; |
| 128 } | 131 } |
| 129 | 132 |
| 130 } // namespace password_manager | 133 } // namespace password_manager |
| OLD | NEW |