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

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: merging conflict 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 952f1dd6cec1735a0ba0eb596ef93991fa5c4e1e..12f969b6401d5d05acecb51449d6f21bca5a18fb 100644
--- a/chrome/browser/chromeos/cros/mount_library.cc
+++ b/chrome/browser/chromeos/cros/mount_library.cc
@@ -34,6 +34,20 @@ std::string MountLibrary::MountTypeToString(MountType type) {
return "";
}
+std::string MountLibrary::MountConditionToString(MountCondition condition) {
+ switch (condition) {
+ case MOUNT_CONDITION_NONE:
+ return "";
+ case MOUNT_CONDITION_UNKNOWN_FILESYSTEM:
+ return "unknown_filesystem";
+ case MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM:
+ return "unsupported_filesystem";
+ default:
+ NOTREACHED();
+ }
+ return "";
+}
+
// static
MountType MountLibrary::MountTypeFromString(
const std::string& type_str) {
@@ -173,7 +187,10 @@ 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,
+ MOUNT_CONDITION_NONE));
return;
}
libcros_proxy_->CallMountPath(source_path, type, options,
@@ -330,9 +347,20 @@ class MountLibraryImpl : public MountLibrary {
MountType type,
const char* mount_path) {
DCHECK(object);
+ MountCondition mount_condition = MOUNT_CONDITION_NONE;
+ if (type == MOUNT_TYPE_DEVICE) {
+ if (error_code == MOUNT_ERROR_UNKNOWN_FILESYSTEM)
+ mount_condition = MOUNT_CONDITION_UNKNOWN_FILESYSTEM;
+ if (error_code == MOUNT_ERROR_UNSUPORTED_FILESYSTEM)
+ mount_condition = MOUNT_CONDITION_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,
+ mount_condition));
}
// Callback for UnmountRemovableDevice method.
@@ -437,20 +465,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.mount_condition) &&
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.mount_condition) &&
mount_info.mount_type == MOUNT_TYPE_DEVICE &&
!mount_info.source_path.empty() &&
!mount_info.mount_path.empty()) {
@@ -480,7 +502,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.mount_condition));
std::string path(mount_points_it->second.source_path);
mount_points_.erase(mount_points_it);
DiskMap::iterator iter = disks_.find(path);
« no previous file with comments | « chrome/browser/chromeos/cros/mount_library.h ('k') | chrome/browser/chromeos/extensions/file_browser_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698