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/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/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_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 "base/prefs/pref_change_registrar.h" | 20 #include "base/prefs/pref_change_registrar.h" |
21 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 21 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 22 #include "chrome/browser/chromeos/file_system_provider/file_system_plugin/plugin
_service.h" |
22 #include "chrome/browser/chromeos/file_system_provider/observer.h" | 23 #include "chrome/browser/chromeos/file_system_provider/observer.h" |
23 #include "chrome/browser/chromeos/file_system_provider/service.h" | 24 #include "chrome/browser/chromeos/file_system_provider/service.h" |
24 #include "chromeos/dbus/cros_disks_client.h" | 25 #include "chromeos/dbus/cros_disks_client.h" |
25 #include "chromeos/disks/disk_mount_manager.h" | 26 #include "chromeos/disks/disk_mount_manager.h" |
26 #include "components/keyed_service/core/keyed_service.h" | 27 #include "components/keyed_service/core/keyed_service.h" |
27 #include "components/storage_monitor/removable_storage_observer.h" | 28 #include "components/storage_monitor/removable_storage_observer.h" |
28 #include "device/media_transfer_protocol/mtp_storage_info.pb.h" | 29 #include "device/media_transfer_protocol/mtp_storage_info.pb.h" |
29 | 30 |
30 class Profile; | 31 class Profile; |
31 | 32 |
(...skipping 17 matching lines...) Expand all Loading... |
49 VOLUME_TYPE_GOOGLE_DRIVE = 0, | 50 VOLUME_TYPE_GOOGLE_DRIVE = 0, |
50 VOLUME_TYPE_DOWNLOADS_DIRECTORY, | 51 VOLUME_TYPE_DOWNLOADS_DIRECTORY, |
51 VOLUME_TYPE_REMOVABLE_DISK_PARTITION, | 52 VOLUME_TYPE_REMOVABLE_DISK_PARTITION, |
52 VOLUME_TYPE_MOUNTED_ARCHIVE_FILE, | 53 VOLUME_TYPE_MOUNTED_ARCHIVE_FILE, |
53 VOLUME_TYPE_PROVIDED, // File system provided by the FileSystemProvider API. | 54 VOLUME_TYPE_PROVIDED, // File system provided by the FileSystemProvider API. |
54 VOLUME_TYPE_MTP, | 55 VOLUME_TYPE_MTP, |
55 // The enum values must be kept in sync with FileManagerVolumeType in | 56 // The enum values must be kept in sync with FileManagerVolumeType in |
56 // tools/metrics/histograms/histograms.xml. Since enums for histograms are | 57 // tools/metrics/histograms/histograms.xml. Since enums for histograms are |
57 // append-only (for keeping the number consistent across versions), new values | 58 // append-only (for keeping the number consistent across versions), new values |
58 // for this enum also has to be always appended at the end (i.e., here). | 59 // for this enum also has to be always appended at the end (i.e., here). |
| 60 VOLUME_TYPE_PLUGIN_PROVIDED, |
59 NUM_VOLUME_TYPE, | 61 NUM_VOLUME_TYPE, |
60 }; | 62 }; |
61 | 63 |
62 // Says how was the mount performed, whether due to user interaction, or | 64 // Says how was the mount performed, whether due to user interaction, or |
63 // automatic. User interaction includes both hardware (pluggins a USB stick) | 65 // automatic. User interaction includes both hardware (pluggins a USB stick) |
64 // or software (mounting a ZIP archive) interaction. | 66 // or software (mounting a ZIP archive) interaction. |
65 enum MountContext { | 67 enum MountContext { |
66 MOUNT_CONTEXT_USER, | 68 MOUNT_CONTEXT_USER, |
67 MOUNT_CONTEXT_AUTO, | 69 MOUNT_CONTEXT_AUTO, |
68 MOUNT_CONTEXT_UNKNOWN | 70 MOUNT_CONTEXT_UNKNOWN |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // FakeMediaTransferProtocolManager for testing. | 204 // FakeMediaTransferProtocolManager for testing. |
203 typedef base::Callback<const MtpStorageInfo*(const std::string&)> | 205 typedef base::Callback<const MtpStorageInfo*(const std::string&)> |
204 GetMtpStorageInfoCallback; | 206 GetMtpStorageInfoCallback; |
205 | 207 |
206 VolumeManager( | 208 VolumeManager( |
207 Profile* profile, | 209 Profile* profile, |
208 drive::DriveIntegrationService* drive_integration_service, | 210 drive::DriveIntegrationService* drive_integration_service, |
209 chromeos::PowerManagerClient* power_manager_client, | 211 chromeos::PowerManagerClient* power_manager_client, |
210 chromeos::disks::DiskMountManager* disk_mount_manager, | 212 chromeos::disks::DiskMountManager* disk_mount_manager, |
211 chromeos::file_system_provider::Service* file_system_provider_service, | 213 chromeos::file_system_provider::Service* file_system_provider_service, |
| 214 chromeos::file_system_provider::PluginService* |
| 215 file_system_plugin_provided_service, |
212 GetMtpStorageInfoCallback get_mtp_storage_info_callback); | 216 GetMtpStorageInfoCallback get_mtp_storage_info_callback); |
213 ~VolumeManager() override; | 217 ~VolumeManager() override; |
214 | 218 |
215 // Returns the instance corresponding to the |context|. | 219 // Returns the instance corresponding to the |context|. |
216 static VolumeManager* Get(content::BrowserContext* context); | 220 static VolumeManager* Get(content::BrowserContext* context); |
217 | 221 |
218 // Initializes this instance. | 222 // Initializes this instance. |
219 void Initialize(); | 223 void Initialize(); |
220 | 224 |
221 // Disposes this instance. | 225 // Disposes this instance. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 void DoUnmountEvent(chromeos::MountError error_code, | 302 void DoUnmountEvent(chromeos::MountError error_code, |
299 const linked_ptr<Volume>& volume); | 303 const linked_ptr<Volume>& volume); |
300 | 304 |
301 Profile* profile_; | 305 Profile* profile_; |
302 drive::DriveIntegrationService* drive_integration_service_; // Not owned. | 306 drive::DriveIntegrationService* drive_integration_service_; // Not owned. |
303 chromeos::disks::DiskMountManager* disk_mount_manager_; // Not owned. | 307 chromeos::disks::DiskMountManager* disk_mount_manager_; // Not owned. |
304 PrefChangeRegistrar pref_change_registrar_; | 308 PrefChangeRegistrar pref_change_registrar_; |
305 base::ObserverList<VolumeManagerObserver> observers_; | 309 base::ObserverList<VolumeManagerObserver> observers_; |
306 chromeos::file_system_provider::Service* | 310 chromeos::file_system_provider::Service* |
307 file_system_provider_service_; // Not owned by this class. | 311 file_system_provider_service_; // Not owned by this class. |
| 312 chromeos::file_system_provider::PluginService* |
| 313 file_system_plugin_provided_service_; |
308 GetMtpStorageInfoCallback get_mtp_storage_info_callback_; | 314 GetMtpStorageInfoCallback get_mtp_storage_info_callback_; |
309 std::map<std::string, linked_ptr<Volume>> mounted_volumes_; | 315 std::map<std::string, linked_ptr<Volume>> mounted_volumes_; |
310 scoped_ptr<SnapshotManager> snapshot_manager_; | 316 scoped_ptr<SnapshotManager> snapshot_manager_; |
311 | 317 |
312 // Note: This should remain the last member so it'll be destroyed and | 318 // Note: This should remain the last member so it'll be destroyed and |
313 // invalidate its weak pointers before any other members are destroyed. | 319 // invalidate its weak pointers before any other members are destroyed. |
314 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; | 320 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; |
315 DISALLOW_COPY_AND_ASSIGN(VolumeManager); | 321 DISALLOW_COPY_AND_ASSIGN(VolumeManager); |
316 }; | 322 }; |
317 | 323 |
318 } // namespace file_manager | 324 } // namespace file_manager |
319 | 325 |
320 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ | 326 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ |
OLD | NEW |