OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FILE_MANAGER_VOLUME_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 chromeos::file_system_provider::Service* file_system_provider_service); | 129 chromeos::file_system_provider::Service* file_system_provider_service); |
130 virtual ~VolumeManager(); | 130 virtual ~VolumeManager(); |
131 | 131 |
132 // Returns the instance corresponding to the |context|. | 132 // Returns the instance corresponding to the |context|. |
133 static VolumeManager* Get(content::BrowserContext* context); | 133 static VolumeManager* Get(content::BrowserContext* context); |
134 | 134 |
135 // Initializes this instance. | 135 // Initializes this instance. |
136 void Initialize(); | 136 void Initialize(); |
137 | 137 |
138 // Disposes this instance. | 138 // Disposes this instance. |
139 virtual void Shutdown() OVERRIDE; | 139 virtual void Shutdown() override; |
140 | 140 |
141 // Adds an observer. | 141 // Adds an observer. |
142 void AddObserver(VolumeManagerObserver* observer); | 142 void AddObserver(VolumeManagerObserver* observer); |
143 | 143 |
144 // Removes the observer. | 144 // Removes the observer. |
145 void RemoveObserver(VolumeManagerObserver* observer); | 145 void RemoveObserver(VolumeManagerObserver* observer); |
146 | 146 |
147 // Returns the information about all volumes currently mounted. | 147 // Returns the information about all volumes currently mounted. |
148 std::vector<VolumeInfo> GetVolumeInfoList() const; | 148 std::vector<VolumeInfo> GetVolumeInfoList() const; |
149 | 149 |
150 // Finds VolumeInfo for the given volume ID. If found, returns true and the | 150 // Finds VolumeInfo for the given volume ID. If found, returns true and the |
151 // result is written into |result|. Returns false otherwise. | 151 // result is written into |result|. Returns false otherwise. |
152 bool FindVolumeInfoById(const std::string& volume_id, | 152 bool FindVolumeInfoById(const std::string& volume_id, |
153 VolumeInfo* result) const; | 153 VolumeInfo* result) const; |
154 | 154 |
155 // For testing purpose, registers a native local file system pointing to | 155 // For testing purpose, registers a native local file system pointing to |
156 // |path| with DOWNLOADS type, and adds its volume info. | 156 // |path| with DOWNLOADS type, and adds its volume info. |
157 bool RegisterDownloadsDirectoryForTesting(const base::FilePath& path); | 157 bool RegisterDownloadsDirectoryForTesting(const base::FilePath& path); |
158 | 158 |
159 // For testing purpose, adds a volume info pointing to |path|, with TESTING | 159 // For testing purpose, adds a volume info pointing to |path|, with TESTING |
160 // type. Assumes that the mount point is already registered. | 160 // type. Assumes that the mount point is already registered. |
161 void AddVolumeInfoForTesting(const base::FilePath& path, | 161 void AddVolumeInfoForTesting(const base::FilePath& path, |
162 VolumeType volume_type, | 162 VolumeType volume_type, |
163 chromeos::DeviceType device_type); | 163 chromeos::DeviceType device_type); |
164 | 164 |
165 // drive::DriveIntegrationServiceObserver overrides. | 165 // drive::DriveIntegrationServiceObserver overrides. |
166 virtual void OnFileSystemMounted() OVERRIDE; | 166 virtual void OnFileSystemMounted() override; |
167 virtual void OnFileSystemBeingUnmounted() OVERRIDE; | 167 virtual void OnFileSystemBeingUnmounted() override; |
168 | 168 |
169 // chromeos::disks::DiskMountManager::Observer overrides. | 169 // chromeos::disks::DiskMountManager::Observer overrides. |
170 virtual void OnDiskEvent( | 170 virtual void OnDiskEvent( |
171 chromeos::disks::DiskMountManager::DiskEvent event, | 171 chromeos::disks::DiskMountManager::DiskEvent event, |
172 const chromeos::disks::DiskMountManager::Disk* disk) OVERRIDE; | 172 const chromeos::disks::DiskMountManager::Disk* disk) override; |
173 virtual void OnDeviceEvent( | 173 virtual void OnDeviceEvent( |
174 chromeos::disks::DiskMountManager::DeviceEvent event, | 174 chromeos::disks::DiskMountManager::DeviceEvent event, |
175 const std::string& device_path) OVERRIDE; | 175 const std::string& device_path) override; |
176 virtual void OnMountEvent( | 176 virtual void OnMountEvent( |
177 chromeos::disks::DiskMountManager::MountEvent event, | 177 chromeos::disks::DiskMountManager::MountEvent event, |
178 chromeos::MountError error_code, | 178 chromeos::MountError error_code, |
179 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info) | 179 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info) |
180 OVERRIDE; | 180 override; |
181 virtual void OnFormatEvent( | 181 virtual void OnFormatEvent( |
182 chromeos::disks::DiskMountManager::FormatEvent event, | 182 chromeos::disks::DiskMountManager::FormatEvent event, |
183 chromeos::FormatError error_code, | 183 chromeos::FormatError error_code, |
184 const std::string& device_path) OVERRIDE; | 184 const std::string& device_path) override; |
185 | 185 |
186 // chromeos::file_system_provider::Observer overrides. | 186 // chromeos::file_system_provider::Observer overrides. |
187 virtual void OnProvidedFileSystemMount( | 187 virtual void OnProvidedFileSystemMount( |
188 const chromeos::file_system_provider::ProvidedFileSystemInfo& | 188 const chromeos::file_system_provider::ProvidedFileSystemInfo& |
189 file_system_info, | 189 file_system_info, |
190 base::File::Error error) OVERRIDE; | 190 base::File::Error error) override; |
191 virtual void OnProvidedFileSystemUnmount( | 191 virtual void OnProvidedFileSystemUnmount( |
192 const chromeos::file_system_provider::ProvidedFileSystemInfo& | 192 const chromeos::file_system_provider::ProvidedFileSystemInfo& |
193 file_system_info, | 193 file_system_info, |
194 base::File::Error error) OVERRIDE; | 194 base::File::Error error) override; |
195 | 195 |
196 // Called on change to kExternalStorageDisabled pref. | 196 // Called on change to kExternalStorageDisabled pref. |
197 void OnExternalStorageDisabledChanged(); | 197 void OnExternalStorageDisabledChanged(); |
198 | 198 |
199 // RemovableStorageObserver overrides. | 199 // RemovableStorageObserver overrides. |
200 virtual void OnRemovableStorageAttached( | 200 virtual void OnRemovableStorageAttached( |
201 const storage_monitor::StorageInfo& info) OVERRIDE; | 201 const storage_monitor::StorageInfo& info) override; |
202 virtual void OnRemovableStorageDetached( | 202 virtual void OnRemovableStorageDetached( |
203 const storage_monitor::StorageInfo& info) OVERRIDE; | 203 const storage_monitor::StorageInfo& info) override; |
204 | 204 |
205 SnapshotManager* snapshot_manager() { return snapshot_manager_.get(); } | 205 SnapshotManager* snapshot_manager() { return snapshot_manager_.get(); } |
206 | 206 |
207 private: | 207 private: |
208 void OnDiskMountManagerRefreshed(bool success); | 208 void OnDiskMountManagerRefreshed(bool success); |
209 void OnStorageMonitorInitialized(); | 209 void OnStorageMonitorInitialized(); |
210 void DoMountEvent(chromeos::MountError error_code, | 210 void DoMountEvent(chromeos::MountError error_code, |
211 const VolumeInfo& volume_info); | 211 const VolumeInfo& volume_info); |
212 void DoUnmountEvent(chromeos::MountError error_code, | 212 void DoUnmountEvent(chromeos::MountError error_code, |
213 const VolumeInfo& volume_info); | 213 const VolumeInfo& volume_info); |
(...skipping 10 matching lines...) Expand all Loading... |
224 | 224 |
225 // Note: This should remain the last member so it'll be destroyed and | 225 // Note: This should remain the last member so it'll be destroyed and |
226 // invalidate its weak pointers before any other members are destroyed. | 226 // invalidate its weak pointers before any other members are destroyed. |
227 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; | 227 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; |
228 DISALLOW_COPY_AND_ASSIGN(VolumeManager); | 228 DISALLOW_COPY_AND_ASSIGN(VolumeManager); |
229 }; | 229 }; |
230 | 230 |
231 } // namespace file_manager | 231 } // namespace file_manager |
232 | 232 |
233 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ | 233 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ |
OLD | NEW |