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

Unified Diff: components/password_manager/core/browser/export/password_exporter.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: comment Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/export/password_exporter.h
diff --git a/components/password_manager/core/browser/export/password_exporter.h b/components/password_manager/core/browser/export/password_exporter.h
new file mode 100644
index 0000000000000000000000000000000000000000..5dcf3c076cfc63fc6e2b90b3c95bb63724a2328c
--- /dev/null
+++ b/components/password_manager/core/browser/export/password_exporter.h
@@ -0,0 +1,50 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_PASSWORD_EXPORTER_H_
+#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_PASSWORD_EXPORTER_H_
+
+#include <string>
+#include <vector>
+
+#include "base/callback_forward.h"
+#include "base/files/file_path.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace autofill {
+struct PasswordForm;
+}
+
+namespace base {
+class FilePath;
+class TaskRunner;
+}
+
+namespace password_manager {
+
+class PasswordExporter {
+ public:
+ // Exports |passwords| into a file at |path|, overwriting any existing file,
+ // and fires |completion| on the calling thread when ready. Blocking IO tasks
+ // will be posted to |blocking_task_runner|. The format of the export will be
+ // selected based on the file extension in |path|.
+ static void Export(const base::FilePath& path,
+ std::vector<scoped_ptr<autofill::PasswordForm>> passwords,
+ scoped_refptr<base::TaskRunner> blocking_task_runner);
+
+ // Returns the file extensions corresponding to supported formats.
+ // Inner vector indicates equivalent extensions. For example:
+ // { { "html", "htm" }, { "csv" } }
+ static std::vector<std::vector<base::FilePath::StringType>>
+ GetSupportedFileExtensions();
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordExporter);
+};
+
+} // namespace password_manager
+
+#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_PASSWORD_EXPORTER_H_

Powered by Google App Engine
This is Rietveld 408576698