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

Unified Diff: components/password_manager/core/browser/import/password_importer.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: Rebase and comments Created 5 years, 5 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/import/password_importer.h
diff --git a/components/password_manager/core/browser/import/password_importer.h b/components/password_manager/core/browser/import/password_importer.h
new file mode 100644
index 0000000000000000000000000000000000000000..35ee36c5e28da85a7566aa0666140151ecedd60f
--- /dev/null
+++ b/components/password_manager/core/browser/import/password_importer.h
@@ -0,0 +1,54 @@
+// Copyright 2014 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_IMPORT_PASSWORD_IMPORTER_H_
+#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_IMPORT_PASSWORD_IMPORTER_H_
+
+#include <string>
+#include <vector>
+
+#include "base/callback.h"
+#include "base/files/file_path.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+
+namespace autofill {
+struct PasswordForm;
+}
+
+namespace base {
+class FilePath;
+class TaskRunner;
+}
+
+namespace password_manager {
+
+class PasswordImporter {
+ public:
+ enum Result { SUCCESS, IO_ERROR, SYNTAX_ERROR, SEMANTIC_ERROR };
+
+ // TODO(engedy): Optimize this for performance?
+ typedef base::Callback<void(Result,
+ const std::vector<autofill::PasswordForm>&)>
+ CompletionCallback;
+
+ // Imports passwords from the file at |path|, and fires |completion| callback
+ // on the calling thread with the passwords when ready. Blocking IO operations
+ // will be posted to |blocking_task_runner|. The file format should correspond
+ // to the extension of the file.
+ static void Import(const base::FilePath& path,
+ scoped_refptr<base::TaskRunner> blocking_task_runner,
+ const CompletionCallback& completion);
+
+ // Returns the file extensions corresponding to supported formats.
+ static std::vector<std::vector<base::FilePath::StringType>>
+ GetSupportedFileExtensions();
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordImporter);
+};
+
+} // namespace password_manager
+
+#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_IMPORT_PASSWORD_IMPORTER_H_

Powered by Google App Engine
This is Rietveld 408576698