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

Side by Side Diff: chrome/browser/media_gallery/media_device_notifications_chromeos.cc

Issue 10843061: [CrOS] Enumerate existing mount points and check for media devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // chromeos::MediaDeviceNotifications implementation. 5 // chromeos::MediaDeviceNotifications implementation.
6 6
7 #include "chrome/browser/media_gallery/media_device_notifications_chromeos.h" 7 #include "chrome/browser/media_gallery/media_device_notifications_chromeos.h"
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 16 matching lines...) Expand all
27 return it == disks.end() ? std::string() : it->second->fs_uuid(); 27 return it == disks.end() ? std::string() : it->second->fs_uuid();
28 } 28 }
29 29
30 } // namespace 30 } // namespace
31 31
32 using content::BrowserThread; 32 using content::BrowserThread;
33 33
34 MediaDeviceNotifications::MediaDeviceNotifications() { 34 MediaDeviceNotifications::MediaDeviceNotifications() {
35 DCHECK(disks::DiskMountManager::GetInstance()); 35 DCHECK(disks::DiskMountManager::GetInstance());
36 disks::DiskMountManager::GetInstance()->AddObserver(this); 36 disks::DiskMountManager::GetInstance()->AddObserver(this);
37 CheckExistingMountPoints();
37 } 38 }
38 39
39 MediaDeviceNotifications::~MediaDeviceNotifications() { 40 MediaDeviceNotifications::~MediaDeviceNotifications() {
40 disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance(); 41 disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance();
41 if (manager) { 42 if (manager) {
42 manager->RemoveObserver(this); 43 manager->RemoveObserver(this);
43 } 44 }
44 } 45 }
45 46
47 void MediaDeviceNotifications::CheckExistingMountPoints() {
48 const disks::DiskMountManager::MountPointMap& mount_point_map =
49 disks::DiskMountManager::GetInstance()->mount_points();
50 for (disks::DiskMountManager::MountPointMap::const_iterator it =
51 mount_point_map.begin(); it != mount_point_map.end(); ++it) {
52 BrowserThread::PostTask(
53 BrowserThread::FILE, FROM_HERE,
54 base::Bind(&MediaDeviceNotifications::CheckMountedPathOnFileThread,
55 this, it->second));
56 }
57 }
58
46 void MediaDeviceNotifications::DiskChanged( 59 void MediaDeviceNotifications::DiskChanged(
47 disks::DiskMountManagerEventType event, 60 disks::DiskMountManagerEventType event,
48 const disks::DiskMountManager::Disk* disk) { 61 const disks::DiskMountManager::Disk* disk) {
49 } 62 }
50 63
51 void MediaDeviceNotifications::DeviceChanged( 64 void MediaDeviceNotifications::DeviceChanged(
52 disks::DiskMountManagerEventType event, 65 disks::DiskMountManagerEventType event,
53 const std::string& device_path) { 66 const std::string& device_path) {
54 } 67 }
55 68
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 138
126 mount_map_.insert(std::make_pair(mount_info.mount_path, device_id_str)); 139 mount_map_.insert(std::make_pair(mount_info.mount_path, device_id_str));
127 base::SystemMonitor::Get()->ProcessMediaDeviceAttached( 140 base::SystemMonitor::Get()->ProcessMediaDeviceAttached(
128 device_id_str, 141 device_id_str,
129 UTF8ToUTF16(FilePath(mount_info.source_path).BaseName().value()), 142 UTF8ToUTF16(FilePath(mount_info.source_path).BaseName().value()),
130 base::SystemMonitor::TYPE_PATH, 143 base::SystemMonitor::TYPE_PATH,
131 mount_info.mount_path); 144 mount_info.mount_path);
132 } 145 }
133 146
134 } // namespace chrome 147 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698