| 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_
|
|
|