OLD | NEW |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 BrowserThread::PostTask( | 103 BrowserThread::PostTask( |
104 BrowserThread::FILE, FROM_HERE, | 104 BrowserThread::FILE, FROM_HERE, |
105 base::Bind(&MediaDeviceNotifications::CheckMountedPathOnFileThread, | 105 base::Bind(&MediaDeviceNotifications::CheckMountedPathOnFileThread, |
106 this, mount_info)); | 106 this, mount_info)); |
107 break; | 107 break; |
108 } | 108 } |
109 case disks::DiskMountManager::UNMOUNTING: { | 109 case disks::DiskMountManager::UNMOUNTING: { |
110 MountMap::iterator it = mount_map_.find(mount_info.mount_path); | 110 MountMap::iterator it = mount_map_.find(mount_info.mount_path); |
111 if (it == mount_map_.end()) | 111 if (it == mount_map_.end()) |
112 return; | 112 return; |
113 base::SystemMonitor::Get()->ProcessMediaDeviceDetached(it->second); | 113 base::SystemMonitor::Get()->ProcessRemovableStorageDetached(it->second); |
114 mount_map_.erase(it); | 114 mount_map_.erase(it); |
115 break; | 115 break; |
116 } | 116 } |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 void MediaDeviceNotifications::CheckMountedPathOnFileThread( | 120 void MediaDeviceNotifications::CheckMountedPathOnFileThread( |
121 const disks::DiskMountManager::MountPointInfo& mount_info) { | 121 const disks::DiskMountManager::MountPointInfo& mount_info) { |
122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
123 | 123 |
(...skipping 23 matching lines...) Expand all Loading... |
147 | 147 |
148 // Keep track of device uuid, to see how often we receive empty uuid values. | 148 // Keep track of device uuid, to see how often we receive empty uuid values. |
149 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_uuid_available", | 149 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_uuid_available", |
150 !unique_id.empty()); | 150 !unique_id.empty()); |
151 if (unique_id.empty()) | 151 if (unique_id.empty()) |
152 return; | 152 return; |
153 | 153 |
154 std::string device_id = chrome::MediaStorageUtil::MakeDeviceId( | 154 std::string device_id = chrome::MediaStorageUtil::MakeDeviceId( |
155 chrome::MediaStorageUtil::USB_MASS_STORAGE_WITH_DCIM, unique_id); | 155 chrome::MediaStorageUtil::USB_MASS_STORAGE_WITH_DCIM, unique_id); |
156 mount_map_.insert(std::make_pair(mount_info.mount_path, device_id)); | 156 mount_map_.insert(std::make_pair(mount_info.mount_path, device_id)); |
157 base::SystemMonitor::Get()->ProcessMediaDeviceAttached(device_id, | 157 base::SystemMonitor::Get()->ProcessRemovableStorageAttached( |
158 device_label, | 158 device_id, |
159 mount_info.mount_path); | 159 device_label, |
| 160 mount_info.mount_path); |
160 } | 161 } |
161 | 162 |
162 } // namespace chrome | 163 } // namespace chrome |
OLD | NEW |