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