Index: chrome/browser/chromeos/cros/mount_library.cc |
diff --git a/chrome/browser/chromeos/cros/mount_library.cc b/chrome/browser/chromeos/cros/mount_library.cc |
index 6b32eb25060e1c883079b625aa8a5f93cecf57b1..b60e0eabe179033d5e78fc0b661cb272fcfeb45a 100644 |
--- a/chrome/browser/chromeos/cros/mount_library.cc |
+++ b/chrome/browser/chromeos/cros/mount_library.cc |
@@ -180,9 +180,8 @@ class MountLibraryImpl : public MountLibrary { |
break; |
} |
} |
- |
if (!disk) { |
- OnFormatDevice(disk->device_path().c_str(), |
+ OnFormatDevice(mount_path, |
false, |
MOUNT_METHOD_ERROR_LOCAL, |
"Device with this mount path not found."); |
@@ -190,7 +189,7 @@ class MountLibraryImpl : public MountLibrary { |
} |
if (formatting_pending_.find(disk->device_path()) != |
formatting_pending_.end()) { |
- OnFormatDevice(disk->device_path().c_str(), |
+ OnFormatDevice(mount_path, |
false, |
MOUNT_METHOD_ERROR_LOCAL, |
"Formatting is already pending."); |
@@ -297,12 +296,18 @@ class MountLibraryImpl : public MountLibrary { |
// Callback for FormatRemovableDevice method. |
static void FormatDeviceCallback(void* object, |
- const char* device_path, |
+ const char* file_path, |
bool success, |
MountMethodErrorType error, |
const char* error_message) { |
DCHECK(object); |
MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); |
+ const char* device_path = self->FilePathToDevicePath(file_path); |
+ if (!device_path) { |
+ LOG(ERROR) << "Error while handling disks metadata. Cannot find " << |
+ "device that is being formatted."; |
tbarzic
2011/08/12 20:49:17
see below
sidor.dev
2011/08/12 20:52:05
Done.
|
+ return; |
+ } |
self->OnFormatDevice(device_path, success, error, error_message); |
} |
@@ -615,6 +620,14 @@ class MountLibraryImpl : public MountLibrary { |
break; |
} |
case FORMATTING_FINISHED: { |
+ // FORMATTING_FINISHED actually returns file path instead of device |
+ // path. |
+ device_path = FilePathToDevicePath(device_path); |
+ if (!device_path) { |
+ LOG(ERROR) << "Error while handling disks metadata. Cannot find " << |
tbarzic
2011/08/12 20:49:17
LOG(ERROR) << "Error..."
<< "device.."
sidor.dev
2011/08/12 20:52:05
Done.
|
+ "device that is being formatted."; |
+ return; |
+ } |
type = MOUNT_FORMATTING_FINISHED; |
break; |
} |
@@ -658,6 +671,15 @@ class MountLibraryImpl : public MountLibrary { |
mount_info)); |
} |
+ const char* FilePathToDevicePath(const char* file_path) { |
+ for (MountLibrary::DiskMap::iterator it = disks_.begin(); |
+ it != disks_.end(); ++it) { |
+ if (it->second->file_path().compare(file_path) == 0) |
+ return it->second->device_path().c_str(); |
+ } |
+ return NULL; |
+ } |
+ |
// Mount event change observers. |
ObserverList<Observer> observers_; |