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

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

Issue 8049002: Don't show hidden devices in UI (exept from imageburner). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 'mock library update' Created 9 years, 3 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 97f4827d4991ce258728fb285cf82c747a62ae80..1910eae2477fd3271d110da2374a877d5528a25b 100644
--- a/chrome/browser/chromeos/cros/mount_library.cc
+++ b/chrome/browser/chromeos/cros/mount_library.cc
@@ -76,7 +76,8 @@ MountLibrary::Disk::Disk(const std::string& device_path,
bool is_parent,
bool is_read_only,
bool has_media,
- bool on_boot_device)
+ bool on_boot_device,
+ bool is_hidden)
: device_path_(device_path),
mount_path_(mount_path),
system_path_(system_path),
@@ -90,7 +91,8 @@ MountLibrary::Disk::Disk(const std::string& device_path,
is_parent_(is_parent),
is_read_only_(is_read_only),
has_media_(has_media),
- on_boot_device_(on_boot_device) {
+ on_boot_device_(on_boot_device),
+ is_hidden_(is_hidden) {
}
MountLibrary::Disk::~Disk() {}
@@ -192,6 +194,15 @@ class MountLibraryImpl : public MountLibrary {
virtual void MountPath(const char* source_path,
MountType type,
const MountPathOptions& options) OVERRIDE {
+ // Hidden and non-existent devices should not be mounted.
+ if (type == MOUNT_TYPE_DEVICE) {
+ DiskMap::const_iterator it = disks_.find(source_path);
+ if (it == disks_.end() || it->second->is_hidden()) {
+ MountCompletedHandler(this, MOUNT_ERROR_INTERNAL, source_path, type,
+ NULL);
+ return;
+ }
+ }
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
libcros_proxy_->CallMountPath(source_path, type, options,
&MountCompletedHandler, this);
@@ -537,9 +548,8 @@ class MountLibraryImpl : public MountLibrary {
}
}
-
void OnGetDiskProperties(const char* device_path,
- const DiskInfo* disk1,
+ const DiskInfo* disk,
MountMethodErrorType error,
const char* error_message) {
DCHECK(device_path);
@@ -550,8 +560,6 @@ class MountLibraryImpl : public MountLibrary {
// This cast is temporal solution, until we merge DiskInfo and
// DiskInfoAdvanced into single interface.
- const DiskInfoAdvanced* disk =
- reinterpret_cast<const DiskInfoAdvanced*>(disk1);
if (disk->on_boot_device())
return;
@@ -608,7 +616,8 @@ class MountLibraryImpl : public MountLibrary {
disk->is_drive(),
disk->is_read_only(),
disk->has_media(),
- disk->on_boot_device());
+ disk->on_boot_device(),
+ disk->is_hidden());
disks_.insert(
std::pair<std::string, Disk*>(device_path_string, new_disk));
FireDiskStatusUpdate(is_new ? MOUNT_DISK_ADDED : MOUNT_DISK_CHANGED,
« 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