OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 { |
| 30 SUCCESS, |
| 31 IO_ERROR, |
| 32 SYNTAX_ERROR, |
| 33 SEMANTIC_ERROR, |
| 34 NUM_IMPORT_RESULTS |
| 35 }; |
| 36 |
| 37 typedef base::Callback<void(Result, |
| 38 const std::vector<autofill::PasswordForm>&)> |
| 39 CompletionCallback; |
| 40 |
| 41 // Imports passwords from the file at |path|, and fires |completion| callback |
| 42 // on the calling thread with the passwords when ready. Blocking IO operations |
| 43 // will be posted to |blocking_task_runner|. The file format should correspond |
| 44 // to the extension of the file. |
| 45 static void Import(const base::FilePath& path, |
| 46 scoped_refptr<base::TaskRunner> blocking_task_runner, |
| 47 const CompletionCallback& completion); |
| 48 |
| 49 // Returns the file extensions corresponding to supported formats. |
| 50 static std::vector<std::vector<base::FilePath::StringType>> |
| 51 GetSupportedFileExtensions(); |
| 52 |
| 53 private: |
| 54 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordImporter); |
| 55 }; |
| 56 |
| 57 } // namespace password_manager |
| 58 |
| 59 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_IMPORT_PASSWORD_IMPORTER_H_ |
OLD | NEW |