Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: components/password_manager/core/browser/import/csv_reader.cc

Issue 1544433002: Replace RE2 import with a dependency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-Added LICENSE and OWNERS file Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "third_party/re2/re2/re2.h" 9 #include "third_party/re2/src/re2/re2.h"
10 10
11 namespace { 11 namespace {
12 12
13 // Regular expression that matches and captures the first row in CSV formatted 13 // 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). 14 // 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 15 // Will throw away the potential trailing EOL character (which is expected to
16 // have already been normalized to a single '\n'). 16 // have already been normalized to a single '\n').
17 const char kFirstRowRE[] = 17 const char kFirstRowRE[] =
18 // Match and capture sequences of 1.) arbitrary characters inside correctly 18 // Match and capture sequences of 1.) arbitrary characters inside correctly
19 // matched double-quotes, or 2.) characters other than the double quote and 19 // matched double-quotes, or 2.) characters other than the double quote and
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 records->resize(records->size() + 1); 121 records->resize(records->size() + 1);
122 for (size_t i = 0; i < column_names->size() && i < fields.size(); ++i) { 122 for (size_t i = 0; i < column_names->size() && i < fields.size(); ++i) {
123 records->back()[(*column_names)[i]].swap(fields[i]); 123 records->back()[(*column_names)[i]].swap(fields[i]);
124 } 124 }
125 } 125 }
126 126
127 return true; 127 return true;
128 } 128 }
129 129
130 } // namespace password_manager 130 } // namespace password_manager
OLDNEW
« no previous file with comments | « components/keyed_service/core/dependency_graph_unittest.cc ('k') | components/plugins/renderer/plugin_placeholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698