Chromium Code Reviews| Index: chrome/browser/storage_monitor/storage_monitor_mac.mm |
| diff --git a/chrome/browser/storage_monitor/removable_device_notifications_mac.mm b/chrome/browser/storage_monitor/storage_monitor_mac.mm |
| similarity index 79% |
| rename from chrome/browser/storage_monitor/removable_device_notifications_mac.mm |
| rename to chrome/browser/storage_monitor/storage_monitor_mac.mm |
| index d1027e45c3707fbccb2ed4130508a4cd5518ff51..6ce48543a2b13b5d84926621f30b44393fda9d96 100644 |
| --- a/chrome/browser/storage_monitor/removable_device_notifications_mac.mm |
| +++ b/chrome/browser/storage_monitor/storage_monitor_mac.mm |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/storage_monitor/removable_device_notifications_mac.h" |
| +#include "chrome/browser/storage_monitor/storage_monitor_mac.h" |
| #include "chrome/browser/storage_monitor/media_device_notifications_utils.h" |
| #include "content/public/browser/browser_thread.h" |
| @@ -14,9 +14,9 @@ namespace { |
| const char kDiskImageModelName[] = "Disk Image"; |
| void GetDiskInfoAndUpdateOnFileThread( |
| - const scoped_refptr<RemovableDeviceNotificationsMac>& notifications, |
| + const scoped_refptr<StorageMonitorMac>& notifications, |
| base::mac::ScopedCFTypeRef<CFDictionaryRef> dict, |
| - RemovableDeviceNotificationsMac::UpdateType update_type) { |
| + StorageMonitorMac::UpdateType update_type) { |
| DiskInfoMac info = DiskInfoMac::BuildDiskInfoOnFileThread(dict); |
| if (info.device_id().empty()) |
| return; |
| @@ -24,16 +24,16 @@ void GetDiskInfoAndUpdateOnFileThread( |
| content::BrowserThread::PostTask( |
| content::BrowserThread::UI, |
| FROM_HERE, |
| - base::Bind(&RemovableDeviceNotificationsMac::UpdateDisk, |
| + base::Bind(&StorageMonitorMac::UpdateDisk, |
| notifications, |
| info, |
| update_type)); |
| } |
| void GetDiskInfoAndUpdate( |
| - const scoped_refptr<RemovableDeviceNotificationsMac>& notifications, |
| + const scoped_refptr<StorageMonitorMac>& notifications, |
| DADiskRef disk, |
| - RemovableDeviceNotificationsMac::UpdateType update_type) { |
| + StorageMonitorMac::UpdateType update_type) { |
| base::mac::ScopedCFTypeRef<CFDictionaryRef> dict(DADiskCopyDescription(disk)); |
| content::BrowserThread::PostTask( |
| content::BrowserThread::FILE, |
| @@ -46,7 +46,7 @@ void GetDiskInfoAndUpdate( |
| } // namespace |
| -RemovableDeviceNotificationsMac::RemovableDeviceNotificationsMac() { |
| +StorageMonitorMac::StorageMonitorMac() { |
| session_.reset(DASessionCreate(NULL)); |
| DASessionScheduleWithRunLoop( |
| @@ -72,12 +72,12 @@ RemovableDeviceNotificationsMac::RemovableDeviceNotificationsMac() { |
| this); |
| } |
| -RemovableDeviceNotificationsMac::~RemovableDeviceNotificationsMac() { |
| +StorageMonitorMac::~StorageMonitorMac() { |
| DASessionUnscheduleFromRunLoop( |
| session_, CFRunLoopGetCurrent(), kCFRunLoopCommonModes); |
| } |
| -void RemovableDeviceNotificationsMac::UpdateDisk( |
| +void StorageMonitorMac::UpdateDisk( |
| const DiskInfoMac& info, |
| UpdateType update_type) { |
| if (info.bsd_name().empty()) |
| @@ -110,7 +110,7 @@ void RemovableDeviceNotificationsMac::UpdateDisk( |
| } |
| } |
| -bool RemovableDeviceNotificationsMac::GetStorageInfoForPath( |
| +bool StorageMonitorMac::GetStorageInfoForPath( |
| const base::FilePath& path, |
| StorageInfo* device_info) const { |
| if (!path.IsAbsolute()) |
| @@ -132,7 +132,7 @@ bool RemovableDeviceNotificationsMac::GetStorageInfoForPath( |
| return false; |
| } |
| -uint64 RemovableDeviceNotificationsMac::GetStorageSize( |
| +uint64 StorageMonitorMac::GetStorageSize( |
| const std::string& location) const { |
| DiskInfoMac info; |
| if (!FindDiskWithMountPoint(base::FilePath(location), &info)) |
| @@ -141,40 +141,40 @@ uint64 RemovableDeviceNotificationsMac::GetStorageSize( |
| } |
| // static |
| -void RemovableDeviceNotificationsMac::DiskAppearedCallback( |
| +void StorageMonitorMac::DiskAppearedCallback( |
| DADiskRef disk, |
| void* context) { |
| - RemovableDeviceNotificationsMac* notifications = |
| - static_cast<RemovableDeviceNotificationsMac*>(context); |
| + StorageMonitorMac* notifications = |
| + static_cast<StorageMonitorMac*>(context); |
|
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap
|
| GetDiskInfoAndUpdate(notifications, |
| disk, |
| UPDATE_DEVICE_ADDED); |
| } |
| // static |
| -void RemovableDeviceNotificationsMac::DiskDisappearedCallback( |
| +void StorageMonitorMac::DiskDisappearedCallback( |
| DADiskRef disk, |
| void* context) { |
| - RemovableDeviceNotificationsMac* notifications = |
| - static_cast<RemovableDeviceNotificationsMac*>(context); |
| + StorageMonitorMac* notifications = |
| + static_cast<StorageMonitorMac*>(context); |
|
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap
|
| GetDiskInfoAndUpdate(notifications, |
| disk, |
| UPDATE_DEVICE_REMOVED); |
| } |
| // static |
| -void RemovableDeviceNotificationsMac::DiskDescriptionChangedCallback( |
| +void StorageMonitorMac::DiskDescriptionChangedCallback( |
| DADiskRef disk, |
| CFArrayRef keys, |
| void *context) { |
| - RemovableDeviceNotificationsMac* notifications = |
| - static_cast<RemovableDeviceNotificationsMac*>(context); |
| + StorageMonitorMac* notifications = |
|
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap
|
| + static_cast<StorageMonitorMac*>(context); |
| GetDiskInfoAndUpdate(notifications, |
| disk, |
| UPDATE_DEVICE_CHANGED); |
| } |
| -bool RemovableDeviceNotificationsMac::ShouldPostNotificationForDisk( |
| +bool StorageMonitorMac::ShouldPostNotificationForDisk( |
| const DiskInfoMac& info) const { |
| // Only post notifications about disks that have no empty fields and |
| // are removable. Also exclude disk images (DMGs). |
| @@ -187,7 +187,7 @@ bool RemovableDeviceNotificationsMac::ShouldPostNotificationForDisk( |
| info.type() == MediaStorageUtil::REMOVABLE_MASS_STORAGE_NO_DCIM); |
| } |
| -bool RemovableDeviceNotificationsMac::FindDiskWithMountPoint( |
| +bool StorageMonitorMac::FindDiskWithMountPoint( |
| const base::FilePath& mount_point, |
| DiskInfoMac* info) const { |
| for (std::map<std::string, DiskInfoMac>::const_iterator |