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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 VOLUME_TYPE_CLOUD_DEVICE, | 51 VOLUME_TYPE_CLOUD_DEVICE, |
52 VOLUME_TYPE_PROVIDED, // File system provided by the FileSystemProvider API. | 52 VOLUME_TYPE_PROVIDED, // File system provided by the FileSystemProvider API. |
53 VOLUME_TYPE_MTP, | 53 VOLUME_TYPE_MTP, |
54 // The enum values must be kept in sync with FileManagerVolumeType in | 54 // The enum values must be kept in sync with FileManagerVolumeType in |
55 // tools/metrics/histograms/histograms.xml. Since enums for histograms are | 55 // tools/metrics/histograms/histograms.xml. Since enums for histograms are |
56 // append-only (for keeping the number consistent across versions), new values | 56 // append-only (for keeping the number consistent across versions), new values |
57 // for this enum also has to be always appended at the end (i.e., here). | 57 // for this enum also has to be always appended at the end (i.e., here). |
58 NUM_VOLUME_TYPE, | 58 NUM_VOLUME_TYPE, |
59 }; | 59 }; |
60 | 60 |
| 61 // Source of a volume's data. |
| 62 enum VolumeSource { |
| 63 VOLUME_SOURCE_UNKNOWN, |
| 64 VOLUME_SOURCE_FILE, |
| 65 VOLUME_SOURCE_DEVICE, |
| 66 VOLUME_SOURCE_NETWORK |
| 67 }; |
| 68 |
61 // Says how was the mount performed, whether due to user interaction, or | 69 // Says how was the mount performed, whether due to user interaction, or |
62 // automatic. User interaction includes both hardware (pluggins a USB stick) | 70 // automatic. User interaction includes both hardware (pluggins a USB stick) |
63 // or software (mounting a ZIP archive) interaction. | 71 // or software (mounting a ZIP archive) interaction. |
64 enum MountContext { | 72 enum MountContext { |
65 MOUNT_CONTEXT_USER, | 73 MOUNT_CONTEXT_USER, |
66 MOUNT_CONTEXT_AUTO, | 74 MOUNT_CONTEXT_AUTO, |
67 MOUNT_CONTEXT_UNKNOWN | 75 MOUNT_CONTEXT_UNKNOWN |
68 }; | 76 }; |
69 | 77 |
70 // Represents a volume (mount point) in the volume manager. Validity of the data | 78 // Represents a volume (mount point) in the volume manager. Validity of the data |
(...skipping 20 matching lines...) Expand all Loading... |
91 VolumeType volume_type, | 99 VolumeType volume_type, |
92 chromeos::DeviceType device_type, | 100 chromeos::DeviceType device_type, |
93 bool read_only); | 101 bool read_only); |
94 static Volume* CreateForTesting(const base::FilePath& device_path, | 102 static Volume* CreateForTesting(const base::FilePath& device_path, |
95 const base::FilePath& mount_path); | 103 const base::FilePath& mount_path); |
96 | 104 |
97 // Getters for all members. See below for details. | 105 // Getters for all members. See below for details. |
98 const std::string& volume_id() const { return volume_id_; } | 106 const std::string& volume_id() const { return volume_id_; } |
99 const std::string& file_system_id() const { return file_system_id_; } | 107 const std::string& file_system_id() const { return file_system_id_; } |
100 const std::string& extension_id() const { return extension_id_; } | 108 const std::string& extension_id() const { return extension_id_; } |
| 109 const VolumeSource volume_source() const { return volume_source_; } |
101 VolumeType type() const { return type_; } | 110 VolumeType type() const { return type_; } |
102 chromeos::DeviceType device_type() const { return device_type_; } | 111 chromeos::DeviceType device_type() const { return device_type_; } |
103 const base::FilePath& source_path() const { return source_path_; } | 112 const base::FilePath& source_path() const { return source_path_; } |
104 const base::FilePath& mount_path() const { return mount_path_; } | 113 const base::FilePath& mount_path() const { return mount_path_; } |
105 chromeos::disks::MountCondition mount_condition() const { | 114 chromeos::disks::MountCondition mount_condition() const { |
106 return mount_condition_; | 115 return mount_condition_; |
107 } | 116 } |
108 MountContext mount_context() const { return mount_context_; } | 117 MountContext mount_context() const { return mount_context_; } |
109 const base::FilePath& system_path_prefix() const { | 118 const base::FilePath& system_path_prefix() const { |
110 return system_path_prefix_; | 119 return system_path_prefix_; |
(...skipping 10 matching lines...) Expand all Loading... |
121 std::string volume_id_; | 130 std::string volume_id_; |
122 | 131 |
123 // The ID for provided file systems. If other type, then empty string. Unique | 132 // The ID for provided file systems. If other type, then empty string. Unique |
124 // per providing extension. | 133 // per providing extension. |
125 std::string file_system_id_; | 134 std::string file_system_id_; |
126 | 135 |
127 // The ID of an extension providing the file system. If other type, then equal | 136 // The ID of an extension providing the file system. If other type, then equal |
128 // to an empty string. | 137 // to an empty string. |
129 std::string extension_id_; | 138 std::string extension_id_; |
130 | 139 |
| 140 // The source of the file system's data. |
| 141 VolumeSource volume_source_; |
| 142 |
131 // The type of mounted volume. | 143 // The type of mounted volume. |
132 VolumeType type_; | 144 VolumeType type_; |
133 | 145 |
134 // The type of device. (e.g. USB, SD card, DVD etc.) | 146 // The type of device. (e.g. USB, SD card, DVD etc.) |
135 chromeos::DeviceType device_type_; | 147 chromeos::DeviceType device_type_; |
136 | 148 |
137 // The source path of the volume. | 149 // The source path of the volume. |
138 // E.g.: | 150 // E.g.: |
139 // - /home/chronos/user/Downloads/zipfile_path.zip | 151 // - /home/chronos/user/Downloads/zipfile_path.zip |
140 base::FilePath source_path_; | 152 base::FilePath source_path_; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 300 |
289 // Note: This should remain the last member so it'll be destroyed and | 301 // Note: This should remain the last member so it'll be destroyed and |
290 // invalidate its weak pointers before any other members are destroyed. | 302 // invalidate its weak pointers before any other members are destroyed. |
291 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; | 303 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; |
292 DISALLOW_COPY_AND_ASSIGN(VolumeManager); | 304 DISALLOW_COPY_AND_ASSIGN(VolumeManager); |
293 }; | 305 }; |
294 | 306 |
295 } // namespace file_manager | 307 } // namespace file_manager |
296 | 308 |
297 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ | 309 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ |
OLD | NEW |