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 |
(...skipping 24 matching lines...) Expand all Loading... |
35 void Init(); | 35 void Init(); |
36 | 36 |
37 void UpdateDisk(const std::string& bsd_name, | 37 void UpdateDisk(const std::string& bsd_name, |
38 const StorageInfo& info, | 38 const StorageInfo& info, |
39 UpdateType update_type); | 39 UpdateType update_type); |
40 | 40 |
41 virtual bool GetStorageInfoForPath( | 41 virtual bool GetStorageInfoForPath( |
42 const base::FilePath& path, | 42 const base::FilePath& path, |
43 StorageInfo* device_info) const OVERRIDE; | 43 StorageInfo* device_info) const OVERRIDE; |
44 | 44 |
45 // Returns the storage size of the device present at |location|. If the | |
46 // device information is unavailable, returns zero. |location| must be a | |
47 // top-level mount point. | |
48 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE; | |
49 | |
50 virtual void EjectDevice( | 45 virtual void EjectDevice( |
51 const std::string& device_id, | 46 const std::string& device_id, |
52 base::Callback<void(EjectStatus)> callback) OVERRIDE; | 47 base::Callback<void(EjectStatus)> callback) OVERRIDE; |
53 | 48 |
54 private: | 49 private: |
55 static void DiskAppearedCallback(DADiskRef disk, void* context); | 50 static void DiskAppearedCallback(DADiskRef disk, void* context); |
56 static void DiskDisappearedCallback(DADiskRef disk, void* context); | 51 static void DiskDisappearedCallback(DADiskRef disk, void* context); |
57 static void DiskDescriptionChangedCallback(DADiskRef disk, | 52 static void DiskDescriptionChangedCallback(DADiskRef disk, |
58 CFArrayRef keys, | 53 CFArrayRef keys, |
59 void *context); | 54 void *context); |
60 | 55 |
61 bool ShouldPostNotificationForDisk(const StorageInfo& info) const; | 56 bool ShouldPostNotificationForDisk(const StorageInfo& info) const; |
62 bool FindDiskWithMountPoint(const base::FilePath& mount_point, | 57 bool FindDiskWithMountPoint(const base::FilePath& mount_point, |
63 StorageInfo* info) const; | 58 StorageInfo* info) const; |
64 | 59 |
65 base::mac::ScopedCFTypeRef<DASessionRef> session_; | 60 base::mac::ScopedCFTypeRef<DASessionRef> session_; |
66 // Maps disk bsd names to disk info objects. This map tracks all mountable | 61 // Maps disk bsd names to disk info objects. This map tracks all mountable |
67 // devices on the system, though only notifications for removable devices are | 62 // devices on the system, though only notifications for removable devices are |
68 // posted. | 63 // posted. |
69 std::map<std::string, StorageInfo> disk_info_map_; | 64 std::map<std::string, StorageInfo> disk_info_map_; |
70 | 65 |
71 scoped_ptr<chrome::ImageCaptureDeviceManager> image_capture_device_manager_; | 66 scoped_ptr<chrome::ImageCaptureDeviceManager> image_capture_device_manager_; |
72 | 67 |
73 DISALLOW_COPY_AND_ASSIGN(StorageMonitorMac); | 68 DISALLOW_COPY_AND_ASSIGN(StorageMonitorMac); |
74 }; | 69 }; |
75 | 70 |
76 } // namespace chrome | 71 } // namespace chrome |
77 | 72 |
78 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ | 73 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ |
OLD | NEW |