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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/files/file.h" | 13 #include "base/files/file.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/prefs/pref_change_registrar.h" | 18 #include "base/prefs/pref_change_registrar.h" |
19 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 19 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
20 #include "chrome/browser/chromeos/file_system_provider/observer.h" | 20 #include "chrome/browser/chromeos/file_system_provider/observer.h" |
21 #include "chrome/browser/chromeos/file_system_provider/service.h" | 21 #include "chrome/browser/chromeos/file_system_provider/service.h" |
22 #include "chrome/browser/local_discovery/storage/privet_volume_lister.h" | |
23 #include "chromeos/dbus/cros_disks_client.h" | 22 #include "chromeos/dbus/cros_disks_client.h" |
24 #include "chromeos/disks/disk_mount_manager.h" | 23 #include "chromeos/disks/disk_mount_manager.h" |
25 #include "components/keyed_service/core/keyed_service.h" | 24 #include "components/keyed_service/core/keyed_service.h" |
26 #include "components/storage_monitor/removable_storage_observer.h" | 25 #include "components/storage_monitor/removable_storage_observer.h" |
27 | 26 |
28 class Profile; | 27 class Profile; |
29 | 28 |
30 namespace chromeos { | 29 namespace chromeos { |
31 class PowerManagerClient; | 30 class PowerManagerClient; |
32 } // namespace chromeos | 31 } // namespace chromeos |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 virtual void OnRemovableStorageAttached( | 200 virtual void OnRemovableStorageAttached( |
202 const storage_monitor::StorageInfo& info) OVERRIDE; | 201 const storage_monitor::StorageInfo& info) OVERRIDE; |
203 virtual void OnRemovableStorageDetached( | 202 virtual void OnRemovableStorageDetached( |
204 const storage_monitor::StorageInfo& info) OVERRIDE; | 203 const storage_monitor::StorageInfo& info) OVERRIDE; |
205 | 204 |
206 SnapshotManager* snapshot_manager() { return snapshot_manager_.get(); } | 205 SnapshotManager* snapshot_manager() { return snapshot_manager_.get(); } |
207 | 206 |
208 private: | 207 private: |
209 void OnDiskMountManagerRefreshed(bool success); | 208 void OnDiskMountManagerRefreshed(bool success); |
210 void OnStorageMonitorInitialized(); | 209 void OnStorageMonitorInitialized(); |
211 void OnPrivetVolumesAvailable( | |
212 const local_discovery::PrivetVolumeLister::VolumeList& volumes); | |
213 void DoMountEvent(chromeos::MountError error_code, | 210 void DoMountEvent(chromeos::MountError error_code, |
214 const VolumeInfo& volume_info); | 211 const VolumeInfo& volume_info); |
215 void DoUnmountEvent(chromeos::MountError error_code, | 212 void DoUnmountEvent(chromeos::MountError error_code, |
216 const VolumeInfo& volume_info); | 213 const VolumeInfo& volume_info); |
217 | 214 |
218 Profile* profile_; | 215 Profile* profile_; |
219 drive::DriveIntegrationService* drive_integration_service_; // Not owned. | 216 drive::DriveIntegrationService* drive_integration_service_; // Not owned. |
220 chromeos::disks::DiskMountManager* disk_mount_manager_; // Not owned. | 217 chromeos::disks::DiskMountManager* disk_mount_manager_; // Not owned. |
221 PrefChangeRegistrar pref_change_registrar_; | 218 PrefChangeRegistrar pref_change_registrar_; |
222 ObserverList<VolumeManagerObserver> observers_; | 219 ObserverList<VolumeManagerObserver> observers_; |
223 scoped_ptr<local_discovery::PrivetVolumeLister> privet_volume_lister_; | |
224 chromeos::file_system_provider::Service* | 220 chromeos::file_system_provider::Service* |
225 file_system_provider_service_; // Not owned by this class. | 221 file_system_provider_service_; // Not owned by this class. |
226 std::map<std::string, VolumeInfo> mounted_volumes_; | 222 std::map<std::string, VolumeInfo> mounted_volumes_; |
227 scoped_ptr<SnapshotManager> snapshot_manager_; | 223 scoped_ptr<SnapshotManager> snapshot_manager_; |
228 | 224 |
229 // 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 |
230 // invalidate its weak pointers before any other members are destroyed. | 226 // invalidate its weak pointers before any other members are destroyed. |
231 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; | 227 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; |
232 DISALLOW_COPY_AND_ASSIGN(VolumeManager); | 228 DISALLOW_COPY_AND_ASSIGN(VolumeManager); |
233 }; | 229 }; |
234 | 230 |
235 } // namespace file_manager | 231 } // namespace file_manager |
236 | 232 |
237 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ | 233 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ |
OLD | NEW |