| 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 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ | 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ |
| 6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ | 6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ |
| 7 | 7 |
| 8 #include <DiskArbitration/DiskArbitration.h> | 8 #include <DiskArbitration/DiskArbitration.h> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "chrome/browser/storage_monitor/disk_info_mac.h" | 13 #include "chrome/browser/storage_monitor/disk_info_mac.h" |
| 14 #include "chrome/browser/storage_monitor/storage_monitor.h" | 14 #include "chrome/browser/storage_monitor/storage_monitor.h" |
| 15 | 15 |
| 16 namespace chrome { | 16 namespace chrome { |
| 17 | 17 |
| 18 class ImageCaptureDeviceManager; |
| 19 |
| 18 // This class posts notifications to listeners when a new disk | 20 // This class posts notifications to listeners when a new disk |
| 19 // is attached, removed, or changed. | 21 // is attached, removed, or changed. |
| 20 class StorageMonitorMac | 22 class StorageMonitorMac |
| 21 : public StorageMonitor, | 23 : public StorageMonitor, |
| 22 public base::RefCountedThreadSafe<StorageMonitorMac> { | 24 public base::RefCountedThreadSafe<StorageMonitorMac> { |
| 23 public: | 25 public: |
| 24 enum UpdateType { | 26 enum UpdateType { |
| 25 UPDATE_DEVICE_ADDED, | 27 UPDATE_DEVICE_ADDED, |
| 26 UPDATE_DEVICE_CHANGED, | 28 UPDATE_DEVICE_CHANGED, |
| 27 UPDATE_DEVICE_REMOVED, | 29 UPDATE_DEVICE_REMOVED, |
| 28 }; | 30 }; |
| 29 | 31 |
| 30 // Should only be called by browser start up code. Use GetInstance() instead. | 32 // Should only be called by browser start up code. Use GetInstance() instead. |
| 31 StorageMonitorMac(); | 33 StorageMonitorMac(); |
| 32 | 34 |
| 35 void Init(); |
| 36 |
| 33 void UpdateDisk(const DiskInfoMac& info, UpdateType update_type); | 37 void UpdateDisk(const DiskInfoMac& info, UpdateType update_type); |
| 34 | 38 |
| 35 virtual bool GetStorageInfoForPath( | 39 virtual bool GetStorageInfoForPath( |
| 36 const base::FilePath& path, | 40 const base::FilePath& path, |
| 37 StorageInfo* device_info) const OVERRIDE; | 41 StorageInfo* device_info) const OVERRIDE; |
| 38 | 42 |
| 39 // Returns the storage size of the device present at |location|. If the | 43 // Returns the storage size of the device present at |location|. If the |
| 40 // device information is unavailable, returns zero. |location| must be a | 44 // device information is unavailable, returns zero. |location| must be a |
| 41 // top-level mount point. | 45 // top-level mount point. |
| 42 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE; | 46 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 58 bool ShouldPostNotificationForDisk(const DiskInfoMac& info) const; | 62 bool ShouldPostNotificationForDisk(const DiskInfoMac& info) const; |
| 59 bool FindDiskWithMountPoint(const base::FilePath& mount_point, | 63 bool FindDiskWithMountPoint(const base::FilePath& mount_point, |
| 60 DiskInfoMac* info) const; | 64 DiskInfoMac* info) const; |
| 61 | 65 |
| 62 base::mac::ScopedCFTypeRef<DASessionRef> session_; | 66 base::mac::ScopedCFTypeRef<DASessionRef> session_; |
| 63 // Maps disk bsd names to disk info objects. This map tracks all mountable | 67 // Maps disk bsd names to disk info objects. This map tracks all mountable |
| 64 // devices on the system though only notifications for removable devices are | 68 // devices on the system though only notifications for removable devices are |
| 65 // posted. | 69 // posted. |
| 66 std::map<std::string, DiskInfoMac> disk_info_map_; | 70 std::map<std::string, DiskInfoMac> disk_info_map_; |
| 67 | 71 |
| 72 scoped_ptr<chrome::ImageCaptureDeviceManager> image_capture_device_manager_; |
| 73 |
| 68 DISALLOW_COPY_AND_ASSIGN(StorageMonitorMac); | 74 DISALLOW_COPY_AND_ASSIGN(StorageMonitorMac); |
| 69 }; | 75 }; |
| 70 | 76 |
| 71 } // namespace chrome | 77 } // namespace chrome |
| 72 | 78 |
| 73 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ | 79 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ |
| OLD | NEW |