| Index: chrome/browser/ui/webui/options/password_manager_handler.h
|
| diff --git a/chrome/browser/ui/webui/options/password_manager_handler.h b/chrome/browser/ui/webui/options/password_manager_handler.h
|
| index 5fa0847d013b45cc22d82a245bd8d39247085a7a..a0bb444f2619f5a9a5539c018ea09ca8a3497ef5 100644
|
| --- a/chrome/browser/ui/webui/options/password_manager_handler.h
|
| +++ b/chrome/browser/ui/webui/options/password_manager_handler.h
|
| @@ -12,14 +12,20 @@
|
| #include "chrome/browser/ui/passwords/password_manager_presenter.h"
|
| #include "chrome/browser/ui/passwords/password_ui_view.h"
|
| #include "chrome/browser/ui/webui/options/options_ui.h"
|
| +#include "components/password_manager/core/browser/import/password_importer.h"
|
| +#include "ui/shell_dialogs/select_file_dialog.h"
|
| +
|
| +class PasswordManagerHandlerTest;
|
|
|
| namespace options {
|
|
|
| // The WebUI based PasswordUIView. Displays passwords in the web ui.
|
| class PasswordManagerHandler : public OptionsPageUIHandler,
|
| - public PasswordUIView {
|
| + public PasswordUIView,
|
| + public ui::SelectFileDialog::Listener {
|
| public:
|
| PasswordManagerHandler();
|
| + explicit PasswordManagerHandler(PasswordManagerPresenter* presenter);
|
| ~PasswordManagerHandler() override;
|
|
|
| // OptionsPageUIHandler implementation.
|
| @@ -28,6 +34,11 @@ class PasswordManagerHandler : public OptionsPageUIHandler,
|
| void InitializePage() override;
|
| void RegisterMessages() override;
|
|
|
| + // ui::SelectFileDialog::Listener implementation
|
| + void FileSelected(const base::FilePath& path,
|
| + int index,
|
| + void* params) override;
|
| +
|
| // PasswordUIView implementation.
|
| Profile* GetProfile() override;
|
| void ShowPassword(
|
| @@ -44,6 +55,8 @@ class PasswordManagerHandler : public OptionsPageUIHandler,
|
| gfx::NativeWindow GetNativeWindow() const override;
|
| #endif
|
| private:
|
| + friend class ::PasswordManagerHandlerTest;
|
| +
|
| // Clears and then populates the list of passwords and password exceptions.
|
| // Called when the JS PasswordManager object is initialized.
|
| void HandleUpdatePasswordLists(const base::ListValue* args);
|
| @@ -60,11 +73,34 @@ class PasswordManagerHandler : public OptionsPageUIHandler,
|
| // |index| The index of the entry.
|
| void HandleRequestShowPassword(const base::ListValue* args);
|
|
|
| + // Import from CSV/JSON file. The steps are:
|
| + // 1. user click import button -> HandlePasswordImport() ->
|
| + // start file selector
|
| + // 2. user selects file -> ImportPasswordFileSeleted() -> read to memory
|
| + // 3. read completes -> ImportPasswordFileRead() -> store to PasswordStore
|
| + void HandlePasswordImport(const base::ListValue* args);
|
| + void ImportPasswordFileSelected(const base::FilePath& path);
|
| + void ImportPasswordFileRead(password_manager::PasswordImporter::Result result,
|
| + const std::vector<autofill::PasswordForm>& forms);
|
| +
|
| + // Export to CSV/JSON file. The steps are:
|
| + // 1. user click export button -> HandlePasswordExport() ->
|
| + // check OS password if necessary -> start file selector
|
| + // 2. user selects file -> ExportPasswordFileSeleted() ->
|
| + // write to memory buffer -> start write operation
|
| + // 3. Writing completes -> ExportPaswordFileWritten()
|
| + void HandlePasswordExport(const base::ListValue* args);
|
| + void ExportPasswordFileSelected(const base::FilePath& path);
|
| + void ExportPasswordFileWritten();
|
| +
|
| // User pref for storing accept languages.
|
| std::string languages_;
|
|
|
| // The PasswordManagerPresenter object owned by the this view.
|
| - PasswordManagerPresenter password_manager_presenter_;
|
| + scoped_ptr<PasswordManagerPresenter> password_manager_presenter_;
|
| +
|
| + // Handle for file picker
|
| + scoped_refptr<ui::SelectFileDialog> selected_file_dialog_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler);
|
| };
|
|
|