summaryrefslogtreecommitdiffstats
path: root/chromeos/disks
diff options
context:
space:
mode:
authorbenchan@google.com <benchan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-13 20:21:29 +0000
committerbenchan@google.com <benchan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-13 20:21:29 +0000
commit202e9fee63b6628689634549de7da84d5ede85d0 (patch)
treeda4fc380873547e422656e52a104b60abff80c0c /chromeos/disks
parent2af35c5008c15b2e906fffe2b4e953591c51d755 (diff)
downloadchromium_src-202e9fee63b6628689634549de7da84d5ede85d0.zip
chromium_src-202e9fee63b6628689634549de7da84d5ede85d0.tar.gz
chromium_src-202e9fee63b6628689634549de7da84d5ede85d0.tar.bz2
Populate vendor and product information of devices reported by CrosDisks.
BUG=chromium-os:33225 TEST=Tested the following: 1. Build Chrome OS. 2. browser_tests --gtest_filter='ExtensionFileBrowserPrivateApiTest*' 3. Manually insert a few removable devices on Chrome OS and verify that DiskMountManager correctly populates vendor and product information returned by org.chromium.CrosDisks.GetDeviceProperties DBus call. Review URL: https://codereview.chromium.org/10905254 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156616 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/disks')
-rw-r--r--chromeos/disks/disk_mount_manager.cc12
-rw-r--r--chromeos/disks/disk_mount_manager.h20
-rw-r--r--chromeos/disks/mock_disk_mount_manager.cc20
3 files changed, 52 insertions, 0 deletions
diff --git a/chromeos/disks/disk_mount_manager.cc b/chromeos/disks/disk_mount_manager.cc
index fded4ad..9850fb3 100644
--- a/chromeos/disks/disk_mount_manager.cc
+++ b/chromeos/disks/disk_mount_manager.cc
@@ -355,6 +355,10 @@ class DiskMountManagerImpl : public DiskMountManager {
disk_info.file_path(),
disk_info.label(),
disk_info.drive_label(),
+ disk_info.vendor_id(),
+ disk_info.vendor_name(),
+ disk_info.product_id(),
+ disk_info.product_name(),
disk_info.uuid(),
FindSystemPathPrefix(disk_info.system_path()),
disk_info.device_type(),
@@ -543,6 +547,10 @@ DiskMountManager::Disk::Disk(const std::string& device_path,
const std::string& file_path,
const std::string& device_label,
const std::string& drive_label,
+ const std::string& vendor_id,
+ const std::string& vendor_name,
+ const std::string& product_id,
+ const std::string& product_name,
const std::string& fs_uuid,
const std::string& system_path_prefix,
DeviceType device_type,
@@ -558,6 +566,10 @@ DiskMountManager::Disk::Disk(const std::string& device_path,
file_path_(file_path),
device_label_(device_label),
drive_label_(drive_label),
+ vendor_id_(vendor_id),
+ vendor_name_(vendor_name),
+ product_id_(product_id),
+ product_name_(product_name),
fs_uuid_(fs_uuid),
system_path_prefix_(system_path_prefix),
device_type_(device_type),
diff --git a/chromeos/disks/disk_mount_manager.h b/chromeos/disks/disk_mount_manager.h
index dfe80c3..e6d46d8 100644
--- a/chromeos/disks/disk_mount_manager.h
+++ b/chromeos/disks/disk_mount_manager.h
@@ -53,6 +53,10 @@ class CHROMEOS_EXPORT DiskMountManager {
const std::string& file_path,
const std::string& device_label,
const std::string& drive_label,
+ const std::string& vendor_id,
+ const std::string& vendor_name,
+ const std::string& product_id,
+ const std::string& product_name,
const std::string& fs_uuid,
const std::string& system_path_prefix,
DeviceType device_type,
@@ -87,6 +91,18 @@ class CHROMEOS_EXPORT DiskMountManager {
// (e.g. "TransMemory")
const std::string& drive_label() const { return drive_label_; }
+ // Vendor ID of the device (e.g. "18d1").
+ const std::string& vendor_id() const { return vendor_id_; }
+
+ // Vendor name of the device (e.g. "Google Inc.").
+ const std::string& vendor_name() const { return vendor_name_; }
+
+ // Product ID of the device (e.g. "4e11").
+ const std::string& product_id() const { return product_id_; }
+
+ // Product name of the device (e.g. "Nexus One").
+ const std::string& product_name() const { return product_name_; }
+
// Returns the file system uuid string.
const std::string& fs_uuid() const { return fs_uuid_; }
@@ -130,6 +146,10 @@ class CHROMEOS_EXPORT DiskMountManager {
std::string file_path_;
std::string device_label_;
std::string drive_label_;
+ std::string vendor_id_;
+ std::string vendor_name_;
+ std::string product_id_;
+ std::string product_name_;
std::string fs_uuid_;
std::string system_path_prefix_;
DeviceType device_type_;
diff --git a/chromeos/disks/mock_disk_mount_manager.cc b/chromeos/disks/mock_disk_mount_manager.cc
index 0b67c9a..610efbb 100644
--- a/chromeos/disks/mock_disk_mount_manager.cc
+++ b/chromeos/disks/mock_disk_mount_manager.cc
@@ -27,6 +27,10 @@ const char* kTestMountPath = "/media/foofoo";
const char* kTestFilePath = "/this/file/path";
const char* kTestDeviceLabel = "A label";
const char* kTestDriveLabel = "Another label";
+const char* kTestVendorId = "0123";
+const char* kTestVendorName = "A vendor";
+const char* kTestProductId = "abcd";
+const char* kTestProductName = "A product";
const char* kTestUuid = "FFFF-FFFF";
} // namespace
@@ -69,6 +73,10 @@ void MockDiskMountManager::NotifyDeviceInsertEvents() {
std::string(kTestFilePath),
std::string(),
std::string(kTestDriveLabel),
+ std::string(kTestVendorId),
+ std::string(kTestVendorName),
+ std::string(kTestProductId),
+ std::string(kTestProductName),
std::string(kTestUuid),
std::string(kTestSystemPathPrefix),
DEVICE_TYPE_USB,
@@ -100,6 +108,10 @@ void MockDiskMountManager::NotifyDeviceInsertEvents() {
std::string(kTestFilePath),
std::string(kTestDeviceLabel),
std::string(kTestDriveLabel),
+ std::string(kTestVendorId),
+ std::string(kTestVendorName),
+ std::string(kTestProductId),
+ std::string(kTestProductName),
std::string(kTestUuid),
std::string(kTestSystemPathPrefix),
DEVICE_TYPE_MOBILE,
@@ -124,6 +136,10 @@ void MockDiskMountManager::NotifyDeviceRemoveEvents() {
std::string(kTestFilePath),
std::string(kTestDeviceLabel),
std::string(kTestDriveLabel),
+ std::string(kTestVendorId),
+ std::string(kTestVendorName),
+ std::string(kTestProductId),
+ std::string(kTestProductName),
std::string(kTestUuid),
std::string(kTestSystemPathPrefix),
DEVICE_TYPE_SD,
@@ -173,6 +189,10 @@ void MockDiskMountManager::CreateDiskEntryForMountDevice(
std::string(), // file_path
std::string(), // device_label
std::string(), // drive_label
+ std::string(), // vendor_id
+ std::string(), // vendor_name
+ std::string(), // product_id
+ std::string(), // product_name
device_id, // fs_uuid
std::string(), // system_path_prefix
DEVICE_TYPE_USB, // device_type