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_EXPORT_PASSWORD_EXPORTER_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_PASSWORD_EXPORTER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/callback_forward.h" |
| 12 #include "base/files/file_path.h" |
| 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" |
| 16 |
| 17 namespace autofill { |
| 18 struct PasswordForm; |
| 19 } |
| 20 |
| 21 namespace base { |
| 22 class FilePath; |
| 23 class TaskRunner; |
| 24 } |
| 25 |
| 26 namespace password_manager { |
| 27 |
| 28 class PasswordExporter { |
| 29 public: |
| 30 // Exports |passwords| into a file at |path|, overwriting any existing file, |
| 31 // and fires |completion| on the calling thread when ready. Blocking IO tasks |
| 32 // will be posted to |blocking_task_runner|. The format of the export will be |
| 33 // selected based on the file extension in |path|. |
| 34 static void Export(const base::FilePath& path, |
| 35 std::vector<scoped_ptr<autofill::PasswordForm>> passwords, |
| 36 scoped_refptr<base::TaskRunner> blocking_task_runner); |
| 37 |
| 38 // Returns the file extensions corresponding to supported formats. |
| 39 // Inner vector indicates equivalent extensions. For example: |
| 40 // { { "html", "htm" }, { "csv" } } |
| 41 static std::vector<std::vector<base::FilePath::StringType>> |
| 42 GetSupportedFileExtensions(); |
| 43 |
| 44 private: |
| 45 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordExporter); |
| 46 }; |
| 47 |
| 48 } // namespace password_manager |
| 49 |
| 50 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_EXPORT_PASSWORD_EXPORTER_H_ |
OLD | NEW |