| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CHROMEOS_CROS_MOUNT_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 bool has_media_; | 128 bool has_media_; |
| 129 bool on_boot_device_; | 129 bool on_boot_device_; |
| 130 }; | 130 }; |
| 131 typedef std::map<std::string, Disk*> DiskMap; | 131 typedef std::map<std::string, Disk*> DiskMap; |
| 132 typedef std::map<std::string, std::string> PathMap; | 132 typedef std::map<std::string, std::string> PathMap; |
| 133 | 133 |
| 134 struct MountPointInfo { | 134 struct MountPointInfo { |
| 135 std::string source_path; | 135 std::string source_path; |
| 136 std::string mount_path; | 136 std::string mount_path; |
| 137 MountType mount_type; | 137 MountType mount_type; |
| 138 std::string special_data; |
| 138 | 139 |
| 139 MountPointInfo(const char* source, const char* mount, const MountType type) | 140 MountPointInfo(const char* source, const char* mount, const MountType type, |
| 141 const char* special) |
| 140 : source_path(source ? source : ""), | 142 : source_path(source ? source : ""), |
| 141 mount_path(mount ? mount : ""), | 143 mount_path(mount ? mount : ""), |
| 142 mount_type(type) { | 144 mount_type(type), |
| 145 special_data(special ? special : "") { |
| 143 } | 146 } |
| 144 }; | 147 }; |
| 145 | 148 |
| 146 // MountPointMap key is mount_path. | 149 // MountPointMap key is mount_path. |
| 147 typedef std::map<std::string, MountPointInfo> MountPointMap; | 150 typedef std::map<std::string, MountPointInfo> MountPointMap; |
| 148 | 151 |
| 149 typedef void(*UnmountDeviceRecursiveCallbackType)(void*, bool); | 152 typedef void(*UnmountDeviceRecursiveCallbackType)(void*, bool); |
| 150 | 153 |
| 151 class Observer { | 154 class Observer { |
| 152 public: | 155 public: |
| 153 virtual ~Observer() {} | 156 virtual ~Observer() {} |
| 154 // Async API events. | 157 // Async API events. |
| 155 virtual void DiskChanged(MountLibraryEventType event, | 158 virtual void DiskChanged(MountLibraryEventType event, |
| 156 const Disk* disk) = 0; | 159 const Disk* disk) = 0; |
| 157 virtual void DeviceChanged(MountLibraryEventType event, | 160 virtual void DeviceChanged(MountLibraryEventType event, |
| 158 const std::string& device_path ) = 0; | 161 const std::string& device_path) = 0; |
| 159 virtual void MountCompleted(MountEvent event_type, | 162 virtual void MountCompleted(MountEvent event_type, |
| 160 MountError error_code, | 163 MountError error_code, |
| 161 const MountPointInfo& mount_info) = 0; | 164 const MountPointInfo& mount_info) = 0; |
| 162 }; | 165 }; |
| 163 | 166 |
| 164 virtual ~MountLibrary() {} | 167 virtual ~MountLibrary() {} |
| 165 virtual void AddObserver(Observer* observer) = 0; | 168 virtual void AddObserver(Observer* observer) = 0; |
| 166 virtual void RemoveObserver(Observer* observer) = 0; | 169 virtual void RemoveObserver(Observer* observer) = 0; |
| 167 virtual const DiskMap& disks() const = 0; | 170 virtual const DiskMap& disks() const = 0; |
| 168 virtual const MountPointMap& mount_points() const = 0; | 171 virtual const MountPointMap& mount_points() const = 0; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 194 virtual void SetLibcrosProxy(MountLibcrosProxy* proxy) {} | 197 virtual void SetLibcrosProxy(MountLibcrosProxy* proxy) {} |
| 195 | 198 |
| 196 // Factory function, creates a new instance and returns ownership. | 199 // Factory function, creates a new instance and returns ownership. |
| 197 // For normal usage, access the singleton via CrosLibrary::Get(). | 200 // For normal usage, access the singleton via CrosLibrary::Get(). |
| 198 static MountLibrary* GetImpl(bool stub); | 201 static MountLibrary* GetImpl(bool stub); |
| 199 }; | 202 }; |
| 200 | 203 |
| 201 } // namespace chromeos | 204 } // namespace chromeos |
| 202 | 205 |
| 203 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_ | 206 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_ |
| OLD | NEW |