| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/files/file.h" | 14 #include "base/files/file.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 20 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 20 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 21 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 21 #include "chrome/browser/chromeos/file_system_provider/observer.h" | 22 #include "chrome/browser/chromeos/file_system_provider/observer.h" |
| 22 #include "chrome/browser/chromeos/file_system_provider/service.h" | 23 #include "chrome/browser/chromeos/file_system_provider/service.h" |
| 23 #include "chromeos/dbus/cros_disks_client.h" | 24 #include "chromeos/dbus/cros_disks_client.h" |
| 24 #include "chromeos/disks/disk_mount_manager.h" | 25 #include "chromeos/disks/disk_mount_manager.h" |
| 25 #include "components/arc/file_system/arc_file_system_observer.h" | |
| 26 #include "components/keyed_service/core/keyed_service.h" | 26 #include "components/keyed_service/core/keyed_service.h" |
| 27 #include "components/prefs/pref_change_registrar.h" | 27 #include "components/prefs/pref_change_registrar.h" |
| 28 #include "components/storage_monitor/removable_storage_observer.h" | 28 #include "components/storage_monitor/removable_storage_observer.h" |
| 29 #include "device/media_transfer_protocol/mtp_storage_info.pb.h" | 29 #include "device/media_transfer_protocol/mtp_storage_info.pb.h" |
| 30 | 30 |
| 31 class Profile; | 31 class Profile; |
| 32 | 32 |
| 33 namespace chromeos { | 33 namespace chromeos { |
| 34 class PowerManagerClient; | 34 class PowerManagerClient; |
| 35 } // namespace chromeos | 35 } // namespace chromeos |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 DISALLOW_COPY_AND_ASSIGN(Volume); | 207 DISALLOW_COPY_AND_ASSIGN(Volume); |
| 208 }; | 208 }; |
| 209 | 209 |
| 210 // Manages "Volume"s for file manager. Here are "Volume"s. | 210 // Manages "Volume"s for file manager. Here are "Volume"s. |
| 211 // - Drive File System (not yet supported). | 211 // - Drive File System (not yet supported). |
| 212 // - Downloads directory. | 212 // - Downloads directory. |
| 213 // - Removable disks (volume will be created for each partition, not only one | 213 // - Removable disks (volume will be created for each partition, not only one |
| 214 // for a device). | 214 // for a device). |
| 215 // - Mounted zip archives. | 215 // - Mounted zip archives. |
| 216 class VolumeManager : public KeyedService, | 216 class VolumeManager : public KeyedService, |
| 217 public arc::ArcFileSystemObserver, | 217 public arc::ArcSessionManager::Observer, |
| 218 public drive::DriveIntegrationServiceObserver, | 218 public drive::DriveIntegrationServiceObserver, |
| 219 public chromeos::disks::DiskMountManager::Observer, | 219 public chromeos::disks::DiskMountManager::Observer, |
| 220 public chromeos::file_system_provider::Observer, | 220 public chromeos::file_system_provider::Observer, |
| 221 public storage_monitor::RemovableStorageObserver { | 221 public storage_monitor::RemovableStorageObserver { |
| 222 public: | 222 public: |
| 223 // Returns MediaTransferProtocolManager. Used for injecting | 223 // Returns MediaTransferProtocolManager. Used for injecting |
| 224 // FakeMediaTransferProtocolManager for testing. | 224 // FakeMediaTransferProtocolManager for testing. |
| 225 typedef base::Callback<const MtpStorageInfo*(const std::string&)> | 225 typedef base::Callback<const MtpStorageInfo*(const std::string&)> |
| 226 GetMtpStorageInfoCallback; | 226 GetMtpStorageInfoCallback; |
| 227 | 227 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 void OnProvidedFileSystemMount( | 294 void OnProvidedFileSystemMount( |
| 295 const chromeos::file_system_provider::ProvidedFileSystemInfo& | 295 const chromeos::file_system_provider::ProvidedFileSystemInfo& |
| 296 file_system_info, | 296 file_system_info, |
| 297 chromeos::file_system_provider::MountContext context, | 297 chromeos::file_system_provider::MountContext context, |
| 298 base::File::Error error) override; | 298 base::File::Error error) override; |
| 299 void OnProvidedFileSystemUnmount( | 299 void OnProvidedFileSystemUnmount( |
| 300 const chromeos::file_system_provider::ProvidedFileSystemInfo& | 300 const chromeos::file_system_provider::ProvidedFileSystemInfo& |
| 301 file_system_info, | 301 file_system_info, |
| 302 base::File::Error error) override; | 302 base::File::Error error) override; |
| 303 | 303 |
| 304 // arc::ArcFileSystemObserver overrides. | 304 // arc::ArcSessionManager::Observer overrides. |
| 305 void OnFileSystemsReady() override; | 305 void OnArcOptInChanged(bool enabled) override; |
| 306 void OnFileSystemsClosed() override; | |
| 307 | 306 |
| 308 // Called on change to kExternalStorageDisabled pref. | 307 // Called on change to kExternalStorageDisabled pref. |
| 309 void OnExternalStorageDisabledChanged(); | 308 void OnExternalStorageDisabledChanged(); |
| 310 | 309 |
| 311 // Called on change to kExternalStorageReadOnly pref. | 310 // Called on change to kExternalStorageReadOnly pref. |
| 312 void OnExternalStorageReadOnlyChanged(); | 311 void OnExternalStorageReadOnlyChanged(); |
| 313 | 312 |
| 314 // RemovableStorageObserver overrides. | 313 // RemovableStorageObserver overrides. |
| 315 void OnRemovableStorageAttached( | 314 void OnRemovableStorageAttached( |
| 316 const storage_monitor::StorageInfo& info) override; | 315 const storage_monitor::StorageInfo& info) override; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 332 Profile* profile_; | 331 Profile* profile_; |
| 333 drive::DriveIntegrationService* drive_integration_service_; // Not owned. | 332 drive::DriveIntegrationService* drive_integration_service_; // Not owned. |
| 334 chromeos::disks::DiskMountManager* disk_mount_manager_; // Not owned. | 333 chromeos::disks::DiskMountManager* disk_mount_manager_; // Not owned. |
| 335 PrefChangeRegistrar pref_change_registrar_; | 334 PrefChangeRegistrar pref_change_registrar_; |
| 336 base::ObserverList<VolumeManagerObserver> observers_; | 335 base::ObserverList<VolumeManagerObserver> observers_; |
| 337 chromeos::file_system_provider::Service* | 336 chromeos::file_system_provider::Service* |
| 338 file_system_provider_service_; // Not owned by this class. | 337 file_system_provider_service_; // Not owned by this class. |
| 339 GetMtpStorageInfoCallback get_mtp_storage_info_callback_; | 338 GetMtpStorageInfoCallback get_mtp_storage_info_callback_; |
| 340 std::map<std::string, linked_ptr<Volume>> mounted_volumes_; | 339 std::map<std::string, linked_ptr<Volume>> mounted_volumes_; |
| 341 std::unique_ptr<SnapshotManager> snapshot_manager_; | 340 std::unique_ptr<SnapshotManager> snapshot_manager_; |
| 341 bool arc_volumes_mounted_ = false; |
| 342 | 342 |
| 343 // Note: This should remain the last member so it'll be destroyed and | 343 // Note: This should remain the last member so it'll be destroyed and |
| 344 // invalidate its weak pointers before any other members are destroyed. | 344 // invalidate its weak pointers before any other members are destroyed. |
| 345 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; | 345 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; |
| 346 DISALLOW_COPY_AND_ASSIGN(VolumeManager); | 346 DISALLOW_COPY_AND_ASSIGN(VolumeManager); |
| 347 }; | 347 }; |
| 348 | 348 |
| 349 } // namespace file_manager | 349 } // namespace file_manager |
| 350 | 350 |
| 351 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ | 351 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ |
| OLD | NEW |