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