| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ | 5 #ifndef COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ |
| 6 #define COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ | 6 #define COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ |
| 7 | 7 |
| 8 #include <DiskArbitration/DiskArbitration.h> | 8 #include <DiskArbitration/DiskArbitration.h> |
| 9 |
| 9 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 10 | 12 |
| 11 #include "base/mac/scoped_cftyperef.h" | 13 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "base/macros.h" | 14 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 14 #include "components/storage_monitor/storage_monitor.h" | 16 #include "components/storage_monitor/storage_monitor.h" |
| 15 | 17 |
| 16 namespace storage_monitor { | 18 namespace storage_monitor { |
| 17 | 19 |
| 18 class ImageCaptureDeviceManager; | 20 class ImageCaptureDeviceManager; |
| 19 | 21 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 43 StorageInfo* device_info) const override; | 45 StorageInfo* device_info) const override; |
| 44 | 46 |
| 45 void EjectDevice(const std::string& device_id, | 47 void EjectDevice(const std::string& device_id, |
| 46 base::Callback<void(EjectStatus)> callback) override; | 48 base::Callback<void(EjectStatus)> callback) override; |
| 47 | 49 |
| 48 private: | 50 private: |
| 49 static void DiskAppearedCallback(DADiskRef disk, void* context); | 51 static void DiskAppearedCallback(DADiskRef disk, void* context); |
| 50 static void DiskDisappearedCallback(DADiskRef disk, void* context); | 52 static void DiskDisappearedCallback(DADiskRef disk, void* context); |
| 51 static void DiskDescriptionChangedCallback(DADiskRef disk, | 53 static void DiskDescriptionChangedCallback(DADiskRef disk, |
| 52 CFArrayRef keys, | 54 CFArrayRef keys, |
| 53 void *context); | 55 void* context); |
| 54 void GetDiskInfoAndUpdate(DADiskRef disk, UpdateType update_type); | 56 void GetDiskInfoAndUpdate(DADiskRef disk, UpdateType update_type); |
| 55 | 57 |
| 56 bool ShouldPostNotificationForDisk(const StorageInfo& info) const; | 58 bool ShouldPostNotificationForDisk(const StorageInfo& info) const; |
| 57 bool FindDiskWithMountPoint(const base::FilePath& mount_point, | 59 bool FindDiskWithMountPoint(const base::FilePath& mount_point, |
| 58 StorageInfo* info) const; | 60 StorageInfo* info) const; |
| 59 | 61 |
| 60 base::ScopedCFTypeRef<DASessionRef> session_; | 62 base::ScopedCFTypeRef<DASessionRef> session_; |
| 61 // Maps disk bsd names to disk info objects. This map tracks all mountable | 63 // Maps disk bsd names to disk info objects. This map tracks all mountable |
| 62 // devices on the system, though only notifications for removable devices are | 64 // devices on the system, though only notifications for removable devices are |
| 63 // posted. | 65 // posted. |
| 64 std::map<std::string, StorageInfo> disk_info_map_; | 66 std::map<std::string, StorageInfo> disk_info_map_; |
| 65 | 67 |
| 66 int pending_disk_updates_; | 68 int pending_disk_updates_; |
| 67 | 69 |
| 68 scoped_ptr<ImageCaptureDeviceManager> image_capture_device_manager_; | 70 std::unique_ptr<ImageCaptureDeviceManager> image_capture_device_manager_; |
| 69 | 71 |
| 70 DISALLOW_COPY_AND_ASSIGN(StorageMonitorMac); | 72 DISALLOW_COPY_AND_ASSIGN(StorageMonitorMac); |
| 71 }; | 73 }; |
| 72 | 74 |
| 73 } // namespace storage_monitor | 75 } // namespace storage_monitor |
| 74 | 76 |
| 75 #endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ | 77 #endif // COMPONENTS_STORAGE_MONITOR_STORAGE_MONITOR_MAC_H_ |
| OLD | NEW |