Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: chrome/browser/chromeos/cros/mount_library.cc

Issue 7706028: This is UI side unreadable device support. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: corrected strings + added mocks + style in js Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6fcbdb0e8254f3215e5efa733e01571602a41d76..d33e4a6d792637367c7f2becf9617b0a8e43c2d8 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.
@@ -437,20 +448,14 @@ class MountLibraryImpl : public MountLibrary {
// If the device is corrupted but it's still possible to format it, it will
// be fake mounted.
- // TODO(sidor): Write more general condition when it will possible.
- bool mount_corrupted_device =
- (error_code == MOUNT_ERROR_UNKNOWN_FILESYSTEM ||
- error_code == MOUNT_ERROR_UNSUPORTED_FILESYSTEM) &&
- mount_info.mount_type == MOUNT_TYPE_DEVICE;
-
- if ((error_code == MOUNT_ERROR_NONE || mount_corrupted_device) &&
+ 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 || mount_corrupted_device) &&
+ 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()) {
@@ -480,7 +485,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);

Powered by Google App Engine
This is Rietveld 408576698