Commit 9fb2070c authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Cleanup for CrostiniExportImport

Add docs for [Export|Import]Container and make
functions consistent with ContainerId as first param.

Change-Id: I6cc9e4eaf7543050d4a144c61ea9b411d4610c91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2073917
Commit-Queue: Nic Hollingum <hollingum@google.com>
Reviewed-by: default avatarNic Hollingum <hollingum@google.com>
Cr-Commit-Position: refs/heads/master@{#744867}
parent 4fd8471f
...@@ -134,8 +134,8 @@ void CrostiniExportImport::ImportContainer(content::WebContents* web_contents) { ...@@ -134,8 +134,8 @@ void CrostiniExportImport::ImportContainer(content::WebContents* web_contents) {
OpenFileDialog(NewOperationData(ExportImportType::IMPORT), web_contents); OpenFileDialog(NewOperationData(ExportImportType::IMPORT), web_contents);
} }
void CrostiniExportImport::ExportContainer(content::WebContents* web_contents, void CrostiniExportImport::ExportContainer(ContainerId container_id,
ContainerId container_id, content::WebContents* web_contents,
OnceTrackerFactory tracker_factory) { OnceTrackerFactory tracker_factory) {
OpenFileDialog( OpenFileDialog(
NewOperationData(ExportImportType::EXPORT, std::move(container_id), NewOperationData(ExportImportType::EXPORT, std::move(container_id),
...@@ -143,8 +143,8 @@ void CrostiniExportImport::ExportContainer(content::WebContents* web_contents, ...@@ -143,8 +143,8 @@ void CrostiniExportImport::ExportContainer(content::WebContents* web_contents,
web_contents); web_contents);
} }
void CrostiniExportImport::ImportContainer(content::WebContents* web_contents, void CrostiniExportImport::ImportContainer(ContainerId container_id,
ContainerId container_id, content::WebContents* web_contents,
OnceTrackerFactory tracker_factory) { OnceTrackerFactory tracker_factory) {
OpenFileDialog( OpenFileDialog(
NewOperationData(ExportImportType::IMPORT, std::move(container_id), NewOperationData(ExportImportType::IMPORT, std::move(container_id),
......
...@@ -102,20 +102,24 @@ class CrostiniExportImport : public KeyedService, ...@@ -102,20 +102,24 @@ class CrostiniExportImport : public KeyedService,
// Import the crostini container showing FileDialog. // Import the crostini container showing FileDialog.
void ImportContainer(content::WebContents* web_contents); void ImportContainer(content::WebContents* web_contents);
// Export |container| to |path| and invoke |callback| when complete. // Export |container_id| to |path| and invoke |callback| when complete.
void ExportContainer(ContainerId container_id, void ExportContainer(ContainerId container_id,
base::FilePath path, base::FilePath path,
CrostiniManager::CrostiniResultCallback callback); CrostiniManager::CrostiniResultCallback callback);
// Import |container| to |path| and invoke |callback| when complete. // Import |container_id| from |path| and invoke |callback| when complete.
void ImportContainer(ContainerId container_id, void ImportContainer(ContainerId container_id,
base::FilePath path, base::FilePath path,
CrostiniManager::CrostiniResultCallback callback); CrostiniManager::CrostiniResultCallback callback);
void ExportContainer(content::WebContents* web_contents, // Export |container_id| showing FileDialog, and using |tracker_factory| for
ContainerId container_id, // status tracking.
void ExportContainer(ContainerId container_id,
content::WebContents* web_contents,
OnceTrackerFactory tracker_factory); OnceTrackerFactory tracker_factory);
void ImportContainer(content::WebContents* web_contents, // Import |container_id| showing FileDialog, and using |tracker_factory| for
ContainerId container_id, // status tracking.
void ImportContainer(ContainerId container_id,
content::WebContents* web_contents,
OnceTrackerFactory tracker_factory); OnceTrackerFactory tracker_factory);
// Cancel currently running export/import. // Cancel currently running export/import.
......
...@@ -134,9 +134,8 @@ void CrostiniUpgrader::StatusTracker::SetStatusFailedWithMessageUI( ...@@ -134,9 +134,8 @@ void CrostiniUpgrader::StatusTracker::SetStatusFailedWithMessageUI(
void CrostiniUpgrader::Backup(const ContainerId& container_id, void CrostiniUpgrader::Backup(const ContainerId& container_id,
content::WebContents* web_contents) { content::WebContents* web_contents) {
CrostiniExportImport::OnceTrackerFactory factory = MakeFactory();
CrostiniExportImport::GetForProfile(profile_)->ExportContainer( CrostiniExportImport::GetForProfile(profile_)->ExportContainer(
web_contents, container_id, std::move(factory)); container_id, web_contents, MakeFactory());
} }
void CrostiniUpgrader::OnBackup(CrostiniResult result) { void CrostiniUpgrader::OnBackup(CrostiniResult result) {
...@@ -243,9 +242,8 @@ void CrostiniUpgrader::OnUpgrade(CrostiniResult result) { ...@@ -243,9 +242,8 @@ void CrostiniUpgrader::OnUpgrade(CrostiniResult result) {
void CrostiniUpgrader::Restore(const ContainerId& container_id, void CrostiniUpgrader::Restore(const ContainerId& container_id,
content::WebContents* web_contents) { content::WebContents* web_contents) {
CrostiniExportImport::OnceTrackerFactory factory = MakeFactory();
CrostiniExportImport::GetForProfile(profile_)->ImportContainer( CrostiniExportImport::GetForProfile(profile_)->ImportContainer(
web_contents, container_id, std::move(factory)); container_id, web_contents, MakeFactory());
} }
void CrostiniUpgrader::OnRestore(CrostiniResult result) { void CrostiniUpgrader::OnRestore(CrostiniResult result) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment