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 4fd4c5c38b6ee08d47b5bd69194b786fb93a4ec9..090e58b3b6b239bd65d46debdde611c9b5dc0c09 100644 |
--- a/chrome/browser/chromeos/cros/mount_library.cc |
+++ b/chrome/browser/chromeos/cros/mount_library.cc |
@@ -173,7 +173,7 @@ class MountLibraryImpl : public MountLibrary { |
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
if (!CrosLibrary::Get()->EnsureLoaded()) { |
OnMountCompleted(MOUNT_ERROR_LIBRARY_NOT_LOADED, |
- MountPointInfo(source_path, NULL, type)); |
+ MountPointInfo(source_path, NULL, type, NULL)); |
return; |
} |
libcros_proxy_->CallMountPath(source_path, type, options, |
@@ -330,9 +330,20 @@ class MountLibraryImpl : public MountLibrary { |
MountType type, |
const char* mount_path) { |
DCHECK(object); |
+ std::string special_data; |
+ if (type == MOUNT_TYPE_DEVICE) { |
+ if (error_code == MOUNT_ERROR_UNKNOWN_FILESYSTEM) |
+ special_data = "unreadable_unknown_filesystem"; |
+ if (error_code == MOUNT_ERROR_UNSUPORTED_FILESYSTEM) |
+ special_data = "unreadable_unsupported_filesystem"; |
+ } |
+ |
MountLibraryImpl* self = static_cast<MountLibraryImpl*>(object); |
self->OnMountCompleted(static_cast<MountError>(error_code), |
- MountPointInfo(source_path, mount_path, type)); |
+ MountPointInfo(source_path, |
+ mount_path, |
+ type, |
+ special_data.c_str())); |
} |
// Callback for UnmountRemovableDevice method. |
@@ -435,14 +446,17 @@ class MountLibraryImpl : public MountLibrary { |
FireMountCompleted(MOUNTING, error_code, mount_info); |
- if (error_code == MOUNT_ERROR_NONE && |
+ // If the device is corrupted but it's still possible to format it, it will |
+ // be fake mounted. |
+ |
+ if ((error_code == MOUNT_ERROR_NONE || !mount_info.special_data.empty()) && |
mount_points_.find(mount_info.mount_path) == mount_points_.end()) { |
mount_points_.insert(MountPointMap::value_type( |
mount_info.mount_path.c_str(), |
mount_info)); |
} |
- if (error_code == MOUNT_ERROR_NONE && |
+ if ((error_code == MOUNT_ERROR_NONE || !mount_info.special_data.empty()) && |
mount_info.mount_type == MOUNT_TYPE_DEVICE && |
!mount_info.source_path.empty() && |
!mount_info.mount_path.empty()) { |
@@ -472,7 +486,8 @@ class MountLibraryImpl : public MountLibrary { |
MOUNT_ERROR_NONE, |
MountPointInfo(mount_points_it->second.source_path.c_str(), |
mount_points_it->second.mount_path.c_str(), |
- mount_points_it->second.mount_type)); |
+ mount_points_it->second.mount_type, |
+ mount_points_it->second.special_data.c_str())); |
std::string path(mount_points_it->second.source_path); |
mount_points_.erase(mount_points_it); |
DiskMap::iterator iter = disks_.find(path); |