Make OnFormatCompleted signal report device's device_path.
While here, remove unused StopFormatting from format manager
BUG=None
TEST=format a removable device in file manager
Change-Id: I0d1ca64f60ed65015433284dfdbf71957836a3f0
Reviewed-on: https://chromium-review.googlesource.com/198304
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Toni Barzic <tbarzic@chromium.org>
Tested-by: Toni Barzic <tbarzic@chromium.org>
diff --git a/cros_disks_server.cc b/cros_disks_server.cc
index 8edfd33..2a9e7d2 100644
--- a/cros_disks_server.cc
+++ b/cros_disks_server.cc
@@ -66,7 +66,9 @@
error_type = FORMAT_ERROR_DEVICE_NOT_ALLOWED;
} else {
error_type =
- format_manager_->StartFormatting(disk.device_file(), filesystem_type);
+ format_manager_->StartFormatting(path,
+ disk.device_file(),
+ filesystem_type);
}
if (error_type != FORMAT_ERROR_NONE) {
diff --git a/format_manager.cc b/format_manager.cc
index 320e874..48c058f 100644
--- a/format_manager.cc
+++ b/format_manager.cc
@@ -49,6 +49,7 @@
}
FormatErrorType FormatManager::StartFormatting(const string& device_path,
+ const string& device_file,
const string& filesystem) {
// Check if the file system is supported for formatting
if (!IsFilesystemSupported(filesystem)) {
@@ -81,7 +82,7 @@
process->AddStringOption("-F", "32");
process->AddStringOption("-n", kDefaultLabel);
}
- process->AddArg(device_path);
+ process->AddArg(device_file);
if (!process->Start()) {
LOG(WARNING) << "Cannot start a process for formatting '"
<< device_path << "' as filesystem '" << filesystem << "'";
@@ -118,12 +119,6 @@
observer_->OnFormatCompleted(device_path, error_type);
}
-FormatErrorType FormatManager::StopFormatting(const string& device_path) {
- // TODO(sidor): implement
- // When the cancel button is hit
- return FORMAT_ERROR_INTERNAL;
-}
-
string FormatManager::GetFormatProgramPath(const string& filesystem) const {
for (size_t i = 0; i < arraysize(kFormatProgramPaths); ++i) {
string path = kFormatProgramPaths[i] + filesystem;
diff --git a/format_manager.h b/format_manager.h
index 8c2f423..7d65306 100644
--- a/format_manager.h
+++ b/format_manager.h
@@ -29,11 +29,9 @@
// Starts a formatting process of a given device.
FormatErrorType StartFormatting(const std::string& device_path,
+ const std::string& device_file,
const std::string& filesystem);
- // Stops a formatting process of a given device.
- FormatErrorType StopFormatting(const std::string& device_path);
-
// Handles a terminated formatting process.
void FormattingFinished(pid_t pid, int status);