Chromium Code Reviews| Index: base/system_monitor/system_monitor.h |
| diff --git a/base/system_monitor/system_monitor.h b/base/system_monitor/system_monitor.h |
| index 3a48e3a9cff6a9302319aae9ee8409ad503ec51e..4d0832635202ffe5097f7ce6099cb47ee245c560 100644 |
| --- a/base/system_monitor/system_monitor.h |
| +++ b/base/system_monitor/system_monitor.h |
| @@ -12,6 +12,7 @@ |
| #include "base/base_export.h" |
| #include "base/basictypes.h" |
| #include "base/file_path.h" |
| +#include "base/files/file_path_watcher.h" |
| #include "base/string16.h" |
| #include "build/build_config.h" |
| @@ -134,6 +135,10 @@ class BASE_EXPORT SystemMonitor { |
| // This is only implemented on Windows currently. |
| virtual void OnDevicesChanged(DeviceType device_type) {} |
| + // Called when the free space of the storage containing the |path| is |
| + // changed. |
| + virtual void OnStorageFreeSpaceChanged(const FilePath::StringType& path); |
| + |
| // When a removable storage device is attached or detached, one of these |
| // two events is triggered. |
| virtual void OnRemovableStorageAttached( |
| @@ -175,9 +180,19 @@ class BASE_EXPORT SystemMonitor { |
| const FilePath::StringType& location); |
| void ProcessRemovableStorageDetached(const std::string& id); |
| + // Start watching the storage device containing the |path| for its free |
| + // space changes. The |path| can be a drive name on Windows, or a device |
| + // name on Linux. Return true if succeeds to start watching. |
| + bool StartWatchStorageDevice(const FilePath::StringType& path); |
|
vandebo (ex-Chrome)
2012/08/28 23:56:30
nit: Watch -> Watching
|
| + // Stop watching the storage device containing the |path|. |
| + bool StopWatchStorageDevice(const FilePath::StringType& path); |
| + |
| private: |
| // Mapping of unique device id to device info tuple. |
| typedef std::map<std::string, RemovableStorageInfo> RemovableStorageMap; |
| + // Mapping of the storage path to watcher. |
| + typedef std::map<FilePath::StringType, |
| + scoped_refptr<FilePathWatcher::PlatformDelegate> > StorageDeviceWatcherMap; |
| #if defined(OS_MACOSX) |
| void PlatformInit(); |
| @@ -195,6 +210,8 @@ class BASE_EXPORT SystemMonitor { |
| // Functions to trigger notifications. |
| void NotifyDevicesChanged(DeviceType device_type); |
| + void NotifyStorageFreeSpaceChanged(const FilePath::StringType& path, |
| + double available_capacity); |
| void NotifyRemovableStorageAttached(const std::string& id, |
| const string16& name, |
| const FilePath::StringType& location); |
| @@ -221,6 +238,9 @@ class BASE_EXPORT SystemMonitor { |
| // Map of all the attached removable storage devices. |
| RemovableStorageMap removable_storage_map_; |
| + // Map of all storage watchers. |
| + StorageDeviceWatcherMap storage_watcher_map_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(SystemMonitor); |
| }; |