| Index: base/system_monitor/system_monitor.cc
|
| ===================================================================
|
| --- base/system_monitor/system_monitor.cc (revision 153336)
|
| +++ base/system_monitor/system_monitor.cc (working copy)
|
| @@ -22,11 +22,11 @@
|
| static int kDelayedBatteryCheckMs = 10 * 1000;
|
| #endif // defined(ENABLE_BATTERY_MONITORING)
|
|
|
| -SystemMonitor::MediaDeviceInfo::MediaDeviceInfo(
|
| +SystemMonitor::RemovableStorageInfo::RemovableStorageInfo(
|
| const std::string& id,
|
| const string16& device_name,
|
| const FilePath::StringType& device_location)
|
| - : unique_id(id),
|
| + : device_id(id),
|
| name(device_name),
|
| location(device_location) {
|
| }
|
| @@ -96,33 +96,33 @@
|
| NotifyDevicesChanged(device_type);
|
| }
|
|
|
| -void SystemMonitor::ProcessMediaDeviceAttached(
|
| +void SystemMonitor::ProcessRemovableStorageAttached(
|
| const std::string& id,
|
| const string16& name,
|
| const FilePath::StringType& location) {
|
| - MediaDeviceInfo info(id, name, location);
|
| - if (ContainsKey(media_device_map_, id)) {
|
| + if (ContainsKey(removable_storage_map_, id)) {
|
| // This can happen if our unique id scheme fails. Ignore the incoming
|
| // non-unique attachment.
|
| return;
|
| }
|
| - media_device_map_.insert(std::make_pair(id, info));
|
| - NotifyMediaDeviceAttached(id, name, location);
|
| + RemovableStorageInfo info(id, name, location);
|
| + removable_storage_map_.insert(std::make_pair(id, info));
|
| + NotifyRemovableStorageAttached(id, name, location);
|
| }
|
|
|
| -void SystemMonitor::ProcessMediaDeviceDetached(const std::string& id) {
|
| - MediaDeviceMap::iterator it = media_device_map_.find(id);
|
| - if (it == media_device_map_.end())
|
| +void SystemMonitor::ProcessRemovableStorageDetached(const std::string& id) {
|
| + RemovableStorageMap::iterator it = removable_storage_map_.find(id);
|
| + if (it == removable_storage_map_.end())
|
| return;
|
| - media_device_map_.erase(it);
|
| - NotifyMediaDeviceDetached(id);
|
| + removable_storage_map_.erase(it);
|
| + NotifyRemovableStorageDetached(id);
|
| }
|
|
|
| -std::vector<SystemMonitor::MediaDeviceInfo>
|
| -SystemMonitor::GetAttachedMediaDevices() const {
|
| - std::vector<MediaDeviceInfo> results;
|
| - for (MediaDeviceMap::const_iterator it = media_device_map_.begin();
|
| - it != media_device_map_.end();
|
| +std::vector<SystemMonitor::RemovableStorageInfo>
|
| +SystemMonitor::GetAttachedRemovableStorage() const {
|
| + std::vector<RemovableStorageInfo> results;
|
| + for (RemovableStorageMap::const_iterator it = removable_storage_map_.begin();
|
| + it != removable_storage_map_.end();
|
| ++it) {
|
| results.push_back(it->second);
|
| }
|
| @@ -151,20 +151,20 @@
|
| &DevicesChangedObserver::OnDevicesChanged, device_type);
|
| }
|
|
|
| -void SystemMonitor::NotifyMediaDeviceAttached(
|
| +void SystemMonitor::NotifyRemovableStorageAttached(
|
| const std::string& id,
|
| const string16& name,
|
| const FilePath::StringType& location) {
|
| - DVLOG(1) << "MediaDeviceAttached with name " << UTF16ToUTF8(name)
|
| + DVLOG(1) << "RemovableStorageAttached with name " << UTF16ToUTF8(name)
|
| << " and id " << id;
|
| devices_changed_observer_list_->Notify(
|
| - &DevicesChangedObserver::OnMediaDeviceAttached, id, name, location);
|
| + &DevicesChangedObserver::OnRemovableStorageAttached, id, name, location);
|
| }
|
|
|
| -void SystemMonitor::NotifyMediaDeviceDetached(const std::string& id) {
|
| - DVLOG(1) << "MediaDeviceDetached for id " << id;
|
| +void SystemMonitor::NotifyRemovableStorageDetached(const std::string& id) {
|
| + DVLOG(1) << "RemovableStorageDetached for id " << id;
|
| devices_changed_observer_list_->Notify(
|
| - &DevicesChangedObserver::OnMediaDeviceDetached, id);
|
| + &DevicesChangedObserver::OnRemovableStorageDetached, id);
|
| }
|
|
|
| void SystemMonitor::NotifyPowerStateChange() {
|
|
|