Commit fffcb681 authored by kmadhusu@chromium.org's avatar kmadhusu@chromium.org

[CrOS] Enumerate existing mount points and check for media devices.

BUG=none
TEST=none


Review URL: https://chromiumcodereview.appspot.com/10843061

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149812 0039d316-1c4b-4281-b951-d872f2087c98
parent f1d4a55f
......@@ -46,6 +46,7 @@ using content::BrowserThread;
MediaDeviceNotifications::MediaDeviceNotifications() {
DCHECK(disks::DiskMountManager::GetInstance());
disks::DiskMountManager::GetInstance()->AddObserver(this);
CheckExistingMountPointsOnUIThread();
}
MediaDeviceNotifications::~MediaDeviceNotifications() {
......@@ -55,6 +56,19 @@ MediaDeviceNotifications::~MediaDeviceNotifications() {
}
}
void MediaDeviceNotifications::CheckExistingMountPointsOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
const disks::DiskMountManager::MountPointMap& mount_point_map =
disks::DiskMountManager::GetInstance()->mount_points();
for (disks::DiskMountManager::MountPointMap::const_iterator it =
mount_point_map.begin(); it != mount_point_map.end(); ++it) {
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
base::Bind(&MediaDeviceNotifications::CheckMountedPathOnFileThread,
this, it->second));
}
}
void MediaDeviceNotifications::DiskChanged(
disks::DiskMountManagerEventType event,
const disks::DiskMountManager::Disk* disk) {
......
......@@ -47,6 +47,10 @@ class MediaDeviceNotifications
// Private to avoid code deleting the object.
virtual ~MediaDeviceNotifications();
// Checks existing mount points map for media devices. For each mount point,
// call CheckMountedPathOnFileThread() below.
void CheckExistingMountPointsOnUIThread();
// Checks if the mount point in |mount_info| is a media device. If it is,
// then continue with AddMountedPathOnUIThread() below.
void CheckMountedPathOnFileThread(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment