OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_IMPORT_PASSWORD_IMPORTER_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_IMPORT_PASSWORD_IMPORTER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/files/file_path.h" |
| 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" |
| 15 |
| 16 namespace autofill { |
| 17 struct PasswordForm; |
| 18 } |
| 19 |
| 20 namespace base { |
| 21 class FilePath; |
| 22 class TaskRunner; |
| 23 } |
| 24 |
| 25 namespace password_manager { |
| 26 |
| 27 class PasswordImporter { |
| 28 public: |
| 29 enum Result { SUCCESS, IO_ERROR, SYNTAX_ERROR, SEMANTIC_ERROR }; |
| 30 |
| 31 // TODO(engedy): Optimize this for performance? |
| 32 typedef base::Callback<void(Result, |
| 33 const std::vector<autofill::PasswordForm>&)> |
| 34 CompletionCallback; |
| 35 |
| 36 // Imports passwords from the file at |path|, and fires |completion| callback |
| 37 // on the calling thread with the passwords when ready. Blocking IO operations |
| 38 // will be posted to |blocking_task_runner|. The file format should correspond |
| 39 // to the extension of the file. |
| 40 static void Import(const base::FilePath& path, |
| 41 scoped_refptr<base::TaskRunner> blocking_task_runner, |
| 42 const CompletionCallback& completion); |
| 43 |
| 44 // Returns the file extensions corresponding to supported formats. |
| 45 static std::vector<std::vector<base::FilePath::StringType>> |
| 46 GetSupportedFileExtensions(); |
| 47 |
| 48 private: |
| 49 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordImporter); |
| 50 }; |
| 51 |
| 52 } // namespace password_manager |
| 53 |
| 54 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_IMPORT_PASSWORD_IMPORTER_H_ |
OLD | NEW |