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

Side by Side Diff: components/password_manager/core/browser/export/csv_writer.h

Issue 1193143003: Enable import/export of passwords into/from Password Manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed import-complete dialog. Created 4 years, 9 months 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 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_CSV_WRITER_H_ 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_CSV_WRITER_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_CSV_WRITER_H_ 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_CSV_WRITER_H_
7 7
8 #include <map>
9 #include <string>
10 #include <vector> 8 #include <vector>
11 9
12 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/password_manager/core/browser/types.h"
13 12
14 namespace password_manager { 13 namespace password_manager {
15 14
16 // Writes tabular data into CSV (Comma Separated Values) format as defined in 15 // Writes tabular data into CSV (Comma Separated Values) format as defined in
17 // RFC 4180, with the following caveats: 16 // RFC 4180, with the following caveats:
18 // * The output encoding will be UTF-8. No code points will be escaped. 17 // * The output encoding will be UTF-8. No code points will be escaped.
19 // * Lines will be separated by the platform-specific EOL terminator. 18 // * Lines will be separated by the platform-specific EOL terminator.
20 // * Values will be enclosed in double-quotes if and only if they contain 19 // * Values will be enclosed in double-quotes if and only if they contain
21 // either of the following characters: CR, LF, double-quote ("), comma (,). 20 // either of the following characters: CR, LF, double-quote ("), comma (,).
22 // 21 //
23 // The CSV representation of the supplied data will be generated into |csv|, 22 // The CSV representation of the supplied data will be generated into |csv|,
24 // which is first cleared of pre-existing data. The first line of the file will 23 // which is first cleared of pre-existing data. The first line of the file will
25 // contain |column_names|, followed by as many lines as there are elements in 24 // contain |column_names|, followed by as many lines as there are elements in
26 // |records|. Each element in |records| should be a dictionary that maps column 25 // |records|. Each element in |records| should be a dictionary that maps column
27 // names to values, so they can be output in the right order. All passed in 26 // names to values, so they can be output in the right order. All passed in
28 // strings should be UTF-8 encoded. 27 // strings should be UTF-8 encoded.
29 void WriteCSV(const std::vector<std::string>& column_names, 28 void WriteCSV(const std::vector<std::string>& column_names,
30 const std::vector<std::map<std::string, std::string>>& records, 29 const std::vector<ColumnNameToValueMap>& records,
31 std::string* csv); 30 std::string* csv);
32 31
33 } // namespace password_manager 32 } // namespace password_manager
34 33
35 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_CSV_WRITER_H_ 34 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_CSV_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698