summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authortbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 18:36:11 +0000
committertbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 18:36:11 +0000
commit3f5d3c6dd8ba59830c9aa484bed524a673749f47 (patch)
tree8d97b627d5b44c2c5053f562242488939c2283ed /chrome/browser
parent951a7013b9589bdf657c5d59822ffbedeec242ba (diff)
downloadchromium_src-3f5d3c6dd8ba59830c9aa484bed524a673749f47.zip
chromium_src-3f5d3c6dd8ba59830c9aa484bed524a673749f47.tar.gz
chromium_src-3f5d3c6dd8ba59830c9aa484bed524a673749f47.tar.bz2
Added some disk info properties
BUG=chromium-os:13257, chromium-os:4413 TEST=NONE Review URL: http://codereview.chromium.org/6809001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/cros/mock_mount_library.cc27
-rw-r--r--chrome/browser/chromeos/cros/mount_library.cc35
-rw-r--r--chrome/browser/chromeos/cros/mount_library.h39
3 files changed, 95 insertions, 6 deletions
diff --git a/chrome/browser/chromeos/cros/mock_mount_library.cc b/chrome/browser/chromeos/cros/mock_mount_library.cc
index 4ea1723..ae0c88d 100644
--- a/chrome/browser/chromeos/cros/mock_mount_library.cc
+++ b/chrome/browser/chromeos/cros/mock_mount_library.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,6 +17,10 @@ using testing::Invoke;
const char* kTestSystemPath = "/this/system/path";
const char* kTestDevicePath = "/this/device/path";
const char* kTestMountPath = "/media/foofoo";
+const char* kTestFilePath = "/this/file/path";
+const char* kTestDeviceLabel = "A label";
+const char* kTestDriveLabel = "Another label";
+const char* kTestParentPath = "/this/is/my/parent";
void MockMountLibrary::AddObserverInternal(MountLibrary::Observer* observer) {
observers_.AddObserver(observer);
@@ -46,6 +50,13 @@ void MockMountLibrary::FireDeviceInsertEvents() {
std::string(kTestDevicePath),
std::string(),
std::string(kTestSystemPath),
+ std::string(kTestFilePath),
+ std::string(),
+ std::string(kTestDriveLabel),
+ std::string(kTestParentPath),
+ FLASH,
+ 4294967295U,
+ false,
false,
true,
false));
@@ -68,6 +79,13 @@ void MockMountLibrary::FireDeviceInsertEvents() {
std::string(kTestDevicePath),
std::string(kTestMountPath),
std::string(kTestSystemPath),
+ std::string(kTestFilePath),
+ std::string(kTestDeviceLabel),
+ std::string(kTestDriveLabel),
+ std::string(kTestParentPath),
+ FLASH,
+ 1073741824,
+ false,
false,
true,
false));
@@ -83,6 +101,13 @@ void MockMountLibrary::FireDeviceRemoveEvents() {
std::string(kTestDevicePath),
std::string(kTestMountPath),
std::string(kTestSystemPath),
+ std::string(kTestFilePath),
+ std::string(kTestDeviceLabel),
+ std::string(kTestDriveLabel),
+ std::string(kTestParentPath),
+ FLASH,
+ 1073741824,
+ false,
false,
true,
false));
diff --git a/chrome/browser/chromeos/cros/mount_library.cc b/chrome/browser/chromeos/cros/mount_library.cc
index cb4c052..0a2b067 100644
--- a/chrome/browser/chromeos/cros/mount_library.cc
+++ b/chrome/browser/chromeos/cros/mount_library.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -134,7 +134,7 @@ class MountLibraryImpl : public MountLibrary {
MountMethodErrorType error,
const char* error_message) {
DCHECK(device_path);
- DCHECK(mount_path);
+
if (error == MOUNT_METHOD_ERROR_NONE && device_path && mount_path) {
std::string path(device_path);
DiskMap::iterator iter = disks_.find(path);
@@ -176,7 +176,7 @@ class MountLibraryImpl : public MountLibrary {
}
void OnGetDiskProperties(const char* device_path,
- const DiskInfo* disk,
+ const DiskInfo* disk1,
MountMethodErrorType error,
const char* error_message) {
DCHECK(device_path);
@@ -184,6 +184,11 @@ class MountLibraryImpl : public MountLibrary {
// TODO(zelidrag): Find a better way to filter these out before we
// fetch the properties:
// Ignore disks coming from the device we booted the system from.
+
+ // 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;
@@ -200,6 +205,11 @@ class MountLibraryImpl : public MountLibrary {
std::string path;
std::string mountpath;
std::string systempath;
+ std::string filepath;
+ std::string devicelabel;
+ std::string drivelabel;
+ std::string parentpath;
+
if (disk->path() != NULL)
path = disk->path();
@@ -209,10 +219,29 @@ class MountLibraryImpl : public MountLibrary {
if (disk->system_path() != NULL)
systempath = disk->system_path();
+ if (disk->file_path() != NULL)
+ filepath = disk->file_path();
+
+ if (disk->label() != NULL)
+ devicelabel = disk->label();
+
+ if (disk->drive_label() != NULL)
+ drivelabel = disk->drive_label();
+
+ if (disk->partition_slave() != NULL)
+ parentpath = disk->partition_slave();
+
Disk* new_disk = new Disk(path,
mountpath,
systempath,
+ filepath,
+ devicelabel,
+ drivelabel,
+ parentpath,
+ disk->device_type(),
+ disk->size(),
disk->is_drive(),
+ disk->is_read_only(),
disk->has_media(),
disk->on_boot_device());
disks_.insert(
diff --git a/chrome/browser/chromeos/cros/mount_library.h b/chrome/browser/chromeos/cros/mount_library.h
index 97fb646..8e796f9 100644
--- a/chrome/browser/chromeos/cros/mount_library.h
+++ b/chrome/browser/chromeos/cros/mount_library.h
@@ -38,13 +38,27 @@ class MountLibrary {
Disk(const std::string& device_path,
const std::string& mount_path,
const std::string& system_path,
+ const std::string& file_path,
+ const std::string& device_label,
+ const std::string& drive_label,
+ const std::string& parent_path,
+ DeviceType device_type,
+ uint64 total_size,
bool is_parent,
+ bool is_read_only,
bool has_media,
bool on_boot_device)
: device_path_(device_path),
mount_path_(mount_path),
system_path_(system_path),
+ file_path_(file_path),
+ device_label_(device_label),
+ drive_label_(drive_label),
+ parent_path_(parent_path),
+ device_type_(device_type),
+ total_size_(total_size),
is_parent_(is_parent),
+ is_read_only_(is_read_only),
has_media_(has_media),
on_boot_device_(on_boot_device) {}
// The path of the device, used by devicekit-disks.
@@ -53,11 +67,25 @@ class MountLibrary {
const std::string& mount_path() const { return mount_path_; }
// The path of the device according to the udev system.
const std::string& system_path() const { return system_path_; }
- // Is the device is a parent device (i.e. sdb rather than sdb1)
+ // The path of the device according to filesystem.
+ const std::string& file_path() const { return file_path_; }
+ // Device's label.
+ const std::string& device_label() const { return device_label_; }
+ // If disk is a parent, then its label, else parents label.
+ const std::string& drive_label() const { return drive_label_; }
+ // Parents device path. If device has no parent, then empty string.
+ const std::string& parent_path() const { return parent_path_; }
+ // Device type.
+ DeviceType device_type() const { return device_type_; }
+ // Total size of the device.
+ uint64 total_size() const { return total_size_; }
+ // Is the device is a parent device (i.e. sdb rather than sdb1).
bool is_parent() const { return is_parent_; }
+ // Is the device read only.
+ bool is_read_only() const { return is_read_only_; }
// Does the device contains media.
bool has_media() const { return has_media_; }
- // Is the device ont
+ // Is the device on the boot device.
bool on_boot_device() const { return on_boot_device_; }
void set_mount_path(const char* mount_path) { mount_path_ = mount_path; }
@@ -66,7 +94,14 @@ class MountLibrary {
std::string device_path_;
std::string mount_path_;
std::string system_path_;
+ std::string file_path_;
+ std::string device_label_;
+ std::string drive_label_;
+ std::string parent_path_;
+ DeviceType device_type_;
+ uint64 total_size_;
bool is_parent_;
+ bool is_read_only_;
bool has_media_;
bool on_boot_device_;
};