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

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: Addressed comments. 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
« no previous file with comments | « chrome/browser/media_gallery/media_device_notifications_chromeos.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CheckExistingMountPointsOnUIThread();
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::CheckExistingMountPointsOnUIThread() {
48 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
49 const disks::DiskMountManager::MountPointMap& mount_point_map =
50 disks::DiskMountManager::GetInstance()->mount_points();
51 for (disks::DiskMountManager::MountPointMap::const_iterator it =
52 mount_point_map.begin(); it != mount_point_map.end(); ++it) {
53 BrowserThread::PostTask(
54 BrowserThread::FILE, FROM_HERE,
55 base::Bind(&MediaDeviceNotifications::CheckMountedPathOnFileThread,
56 this, it->second));
57 }
58 }
59
46 void MediaDeviceNotifications::DiskChanged( 60 void MediaDeviceNotifications::DiskChanged(
47 disks::DiskMountManagerEventType event, 61 disks::DiskMountManagerEventType event,
48 const disks::DiskMountManager::Disk* disk) { 62 const disks::DiskMountManager::Disk* disk) {
49 } 63 }
50 64
51 void MediaDeviceNotifications::DeviceChanged( 65 void MediaDeviceNotifications::DeviceChanged(
52 disks::DiskMountManagerEventType event, 66 disks::DiskMountManagerEventType event,
53 const std::string& device_path) { 67 const std::string& device_path) {
54 } 68 }
55 69
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 139
126 mount_map_.insert(std::make_pair(mount_info.mount_path, device_id_str)); 140 mount_map_.insert(std::make_pair(mount_info.mount_path, device_id_str));
127 base::SystemMonitor::Get()->ProcessMediaDeviceAttached( 141 base::SystemMonitor::Get()->ProcessMediaDeviceAttached(
128 device_id_str, 142 device_id_str,
129 UTF8ToUTF16(FilePath(mount_info.source_path).BaseName().value()), 143 UTF8ToUTF16(FilePath(mount_info.source_path).BaseName().value()),
130 base::SystemMonitor::TYPE_PATH, 144 base::SystemMonitor::TYPE_PATH,
131 mount_info.mount_path); 145 mount_info.mount_path);
132 } 146 }
133 147
134 } // namespace chrome 148 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/media_gallery/media_device_notifications_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698