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> | |
10 #include <set> | |
9 #include <string> | 11 #include <string> |
10 #include <map> | |
11 | 12 |
12 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
14 #include "base/time.h" | 15 #include "base/time.h" |
15 #include "third_party/cros/chromeos_mount.h" | 16 #include "third_party/cros/chromeos_mount.h" |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 | 19 |
19 typedef enum MountLibraryEventType { | 20 typedef enum MountLibraryEventType { |
20 MOUNT_DISK_ADDED, | 21 MOUNT_DISK_ADDED, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 std::string parent_path_; | 91 std::string parent_path_; |
91 DeviceType device_type_; | 92 DeviceType device_type_; |
92 uint64 total_size_; | 93 uint64 total_size_; |
93 bool is_parent_; | 94 bool is_parent_; |
94 bool is_read_only_; | 95 bool is_read_only_; |
95 bool has_media_; | 96 bool has_media_; |
96 bool on_boot_device_; | 97 bool on_boot_device_; |
97 }; | 98 }; |
98 typedef std::map<std::string, Disk*> DiskMap; | 99 typedef std::map<std::string, Disk*> DiskMap; |
99 | 100 |
101 typedef std::set<std::string> MountPointSet; | |
zel
2011/07/22 04:47:17
this does not have enough information, in addition
tbarzic
2011/07/22 06:21:51
I know, I had in plan to add these (well, at least
| |
102 | |
100 typedef void(*UnmountDeviceRecursiveCallbackType)(void*, bool); | 103 typedef void(*UnmountDeviceRecursiveCallbackType)(void*, bool); |
101 | 104 |
102 class Observer { | 105 class Observer { |
103 public: | 106 public: |
104 virtual ~Observer() {} | 107 virtual ~Observer() {} |
105 // Async API events. | 108 // Async API events. |
106 virtual void DiskChanged(MountLibraryEventType event, | 109 virtual void DiskChanged(MountLibraryEventType event, |
107 const Disk* disk) = 0; | 110 const Disk* disk) = 0; |
108 virtual void DeviceChanged(MountLibraryEventType event, | 111 virtual void DeviceChanged(MountLibraryEventType event, |
109 const std::string& device_path ) = 0; | 112 const std::string& device_path ) = 0; |
113 virtual void MountCompleted(MountError error_code, | |
114 const std::string& source, | |
115 MountType mount_type, | |
116 const std::string& mount_path) = 0; | |
110 }; | 117 }; |
111 | 118 |
112 virtual ~MountLibrary() {} | 119 virtual ~MountLibrary() {} |
113 virtual void AddObserver(Observer* observer) = 0; | 120 virtual void AddObserver(Observer* observer) = 0; |
114 virtual void RemoveObserver(Observer* observer) = 0; | 121 virtual void RemoveObserver(Observer* observer) = 0; |
115 virtual const DiskMap& disks() const = 0; | 122 virtual const DiskMap& disks() const = 0; |
123 virtual const MountPointSet& mount_points() const = 0; | |
116 | 124 |
117 virtual void RequestMountInfoRefresh() = 0; | 125 virtual void RequestMountInfoRefresh() = 0; |
118 virtual void MountPath(const char* device_path) = 0; | 126 virtual void MountPath(const char* source_path, |
119 virtual void UnmountPath(const char* device_path) = 0; | 127 MountType type, |
128 const MountPathOptions& options) = 0; | |
129 // |path| may be source od mount path. | |
130 virtual void UnmountPath(const char* path) = 0; | |
120 | 131 |
121 // Unmounts device_poath and all of its known children. | 132 // Unmounts device_poath and all of its known children. |
122 virtual void UnmountDeviceRecursive(const char* device_path, | 133 virtual void UnmountDeviceRecursive(const char* device_path, |
123 UnmountDeviceRecursiveCallbackType callback, void* user_data) = 0; | 134 UnmountDeviceRecursiveCallbackType callback, void* user_data) = 0; |
124 | 135 |
125 // Factory function, creates a new instance and returns ownership. | 136 // Factory function, creates a new instance and returns ownership. |
126 // For normal usage, access the singleton via CrosLibrary::Get(). | 137 // For normal usage, access the singleton via CrosLibrary::Get(). |
127 static MountLibrary* GetImpl(bool stub); | 138 static MountLibrary* GetImpl(bool stub); |
128 }; | 139 }; |
129 | 140 |
130 } // namespace chromeos | 141 } // namespace chromeos |
131 | 142 |
132 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_ | 143 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOUNT_LIBRARY_H_ |
OLD | NEW |