Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/chromeos/file_manager/volume_manager.cc

Issue 677413007: Add a has_media flag to VolumeMetadata. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing VolumeInfo initializer. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/browser/chromeos/file_manager/volume_manager.h" 5 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 drive::util::GetDriveMountPointPath(profile); 125 drive::util::GetDriveMountPointPath(profile);
126 126
127 VolumeInfo volume_info; 127 VolumeInfo volume_info;
128 volume_info.type = VOLUME_TYPE_GOOGLE_DRIVE; 128 volume_info.type = VOLUME_TYPE_GOOGLE_DRIVE;
129 volume_info.device_type = chromeos::DEVICE_TYPE_UNKNOWN; 129 volume_info.device_type = chromeos::DEVICE_TYPE_UNKNOWN;
130 volume_info.source_path = drive_path; 130 volume_info.source_path = drive_path;
131 volume_info.mount_path = drive_path; 131 volume_info.mount_path = drive_path;
132 volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE; 132 volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE;
133 volume_info.is_parent = false; 133 volume_info.is_parent = false;
134 volume_info.is_read_only = false; 134 volume_info.is_read_only = false;
135 volume_info.has_media = false;
135 volume_info.volume_id = GenerateVolumeId(volume_info); 136 volume_info.volume_id = GenerateVolumeId(volume_info);
136 return volume_info; 137 return volume_info;
137 } 138 }
138 139
139 VolumeInfo CreateDownloadsVolumeInfo(const base::FilePath& downloads_path) { 140 VolumeInfo CreateDownloadsVolumeInfo(const base::FilePath& downloads_path) {
140 VolumeInfo volume_info; 141 VolumeInfo volume_info;
141 volume_info.type = VOLUME_TYPE_DOWNLOADS_DIRECTORY; 142 volume_info.type = VOLUME_TYPE_DOWNLOADS_DIRECTORY;
142 volume_info.device_type = chromeos::DEVICE_TYPE_UNKNOWN; 143 volume_info.device_type = chromeos::DEVICE_TYPE_UNKNOWN;
143 // Keep source_path empty. 144 // Keep source_path empty.
144 volume_info.mount_path = downloads_path; 145 volume_info.mount_path = downloads_path;
145 volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE; 146 volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE;
146 volume_info.is_parent = false; 147 volume_info.is_parent = false;
147 volume_info.is_read_only = false; 148 volume_info.is_read_only = false;
149 volume_info.has_media = false;
148 volume_info.volume_id = GenerateVolumeId(volume_info); 150 volume_info.volume_id = GenerateVolumeId(volume_info);
149 return volume_info; 151 return volume_info;
150 } 152 }
151 153
152 VolumeInfo CreateTestingVolumeInfo(const base::FilePath& path, 154 VolumeInfo CreateTestingVolumeInfo(const base::FilePath& path,
153 VolumeType volume_type, 155 VolumeType volume_type,
154 chromeos::DeviceType device_type) { 156 chromeos::DeviceType device_type) {
155 VolumeInfo volume_info; 157 VolumeInfo volume_info;
156 volume_info.type = volume_type; 158 volume_info.type = volume_type;
157 volume_info.device_type = device_type; 159 volume_info.device_type = device_type;
158 // Keep source_path empty. 160 // Keep source_path empty.
159 volume_info.mount_path = path; 161 volume_info.mount_path = path;
160 volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE; 162 volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE;
161 volume_info.is_parent = false; 163 volume_info.is_parent = false;
162 volume_info.is_read_only = false; 164 volume_info.is_read_only = false;
165 volume_info.has_media = false;
163 volume_info.volume_id = GenerateVolumeId(volume_info); 166 volume_info.volume_id = GenerateVolumeId(volume_info);
164 return volume_info; 167 return volume_info;
165 } 168 }
166 169
167 VolumeInfo CreateVolumeInfoFromMountPointInfo( 170 VolumeInfo CreateVolumeInfoFromMountPointInfo(
168 const chromeos::disks::DiskMountManager::MountPointInfo& mount_point, 171 const chromeos::disks::DiskMountManager::MountPointInfo& mount_point,
169 const chromeos::disks::DiskMountManager::Disk* disk) { 172 const chromeos::disks::DiskMountManager::Disk* disk) {
170 VolumeInfo volume_info; 173 VolumeInfo volume_info;
171 volume_info.type = MountTypeToVolumeType(mount_point.mount_type); 174 volume_info.type = MountTypeToVolumeType(mount_point.mount_type);
172 volume_info.source_path = base::FilePath(mount_point.source_path); 175 volume_info.source_path = base::FilePath(mount_point.source_path);
173 volume_info.mount_path = base::FilePath(mount_point.mount_path); 176 volume_info.mount_path = base::FilePath(mount_point.mount_path);
174 volume_info.mount_condition = mount_point.mount_condition; 177 volume_info.mount_condition = mount_point.mount_condition;
175 volume_info.volume_label = volume_info.mount_path.BaseName().AsUTF8Unsafe(); 178 volume_info.volume_label = volume_info.mount_path.BaseName().AsUTF8Unsafe();
176 if (disk) { 179 if (disk) {
177 volume_info.device_type = disk->device_type(); 180 volume_info.device_type = disk->device_type();
178 volume_info.system_path_prefix = 181 volume_info.system_path_prefix =
179 base::FilePath(disk->system_path_prefix()); 182 base::FilePath(disk->system_path_prefix());
180 volume_info.is_parent = disk->is_parent(); 183 volume_info.is_parent = disk->is_parent();
181 volume_info.is_read_only = disk->is_read_only(); 184 volume_info.is_read_only = disk->is_read_only();
185 volume_info.has_media = disk->has_media();
182 } else { 186 } else {
183 volume_info.device_type = chromeos::DEVICE_TYPE_UNKNOWN; 187 volume_info.device_type = chromeos::DEVICE_TYPE_UNKNOWN;
184 volume_info.is_parent = false; 188 volume_info.is_parent = false;
185 volume_info.is_read_only = 189 volume_info.is_read_only =
186 (mount_point.mount_type == chromeos::MOUNT_TYPE_ARCHIVE); 190 (mount_point.mount_type == chromeos::MOUNT_TYPE_ARCHIVE);
191 volume_info.has_media = false;
187 } 192 }
188 volume_info.volume_id = GenerateVolumeId(volume_info); 193 volume_info.volume_id = GenerateVolumeId(volume_info);
189 194
190 return volume_info; 195 return volume_info;
191 } 196 }
192 197
193 VolumeInfo CreateProvidedFileSystemVolumeInfo( 198 VolumeInfo CreateProvidedFileSystemVolumeInfo(
194 const chromeos::file_system_provider::ProvidedFileSystemInfo& 199 const chromeos::file_system_provider::ProvidedFileSystemInfo&
195 file_system_info) { 200 file_system_info) {
196 VolumeInfo volume_info; 201 VolumeInfo volume_info;
197 volume_info.file_system_id = file_system_info.file_system_id(); 202 volume_info.file_system_id = file_system_info.file_system_id();
198 volume_info.extension_id = file_system_info.extension_id(); 203 volume_info.extension_id = file_system_info.extension_id();
199 volume_info.volume_label = file_system_info.display_name(); 204 volume_info.volume_label = file_system_info.display_name();
200 volume_info.type = VOLUME_TYPE_PROVIDED; 205 volume_info.type = VOLUME_TYPE_PROVIDED;
201 volume_info.mount_path = file_system_info.mount_path(); 206 volume_info.mount_path = file_system_info.mount_path();
202 volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE; 207 volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE;
203 volume_info.is_parent = true; 208 volume_info.is_parent = true;
204 volume_info.is_read_only = !file_system_info.writable(); 209 volume_info.is_read_only = !file_system_info.writable();
210 volume_info.has_media = false;
205 volume_info.volume_id = GenerateVolumeId(volume_info); 211 volume_info.volume_id = GenerateVolumeId(volume_info);
206 return volume_info; 212 return volume_info;
207 } 213 }
208 214
209 std::string GetMountPointNameForMediaStorage( 215 std::string GetMountPointNameForMediaStorage(
210 const storage_monitor::StorageInfo& info) { 216 const storage_monitor::StorageInfo& info) {
211 std::string name(kFileManagerMTPMountNamePrefix); 217 std::string name(kFileManagerMTPMountNamePrefix);
212 name += info.device_id(); 218 name += info.device_id();
213 return name; 219 return name;
214 } 220 }
215 221
216 } // namespace 222 } // namespace
217 223
218 VolumeInfo::VolumeInfo() 224 VolumeInfo::VolumeInfo()
219 : type(VOLUME_TYPE_GOOGLE_DRIVE), 225 : type(VOLUME_TYPE_GOOGLE_DRIVE),
220 device_type(chromeos::DEVICE_TYPE_UNKNOWN), 226 device_type(chromeos::DEVICE_TYPE_UNKNOWN),
221 mount_condition(chromeos::disks::MOUNT_CONDITION_NONE), 227 mount_condition(chromeos::disks::MOUNT_CONDITION_NONE),
222 is_parent(false), 228 is_parent(false),
223 is_read_only(false) { 229 is_read_only(false),
230 has_media(false) {
224 } 231 }
225 232
226 VolumeInfo::~VolumeInfo() { 233 VolumeInfo::~VolumeInfo() {
227 } 234 }
228 235
229 VolumeManager::VolumeManager( 236 VolumeManager::VolumeManager(
230 Profile* profile, 237 Profile* profile,
231 drive::DriveIntegrationService* drive_integration_service, 238 drive::DriveIntegrationService* drive_integration_service,
232 chromeos::PowerManagerClient* power_manager_client, 239 chromeos::PowerManagerClient* power_manager_client,
233 chromeos::disks::DiskMountManager* disk_mount_manager, 240 chromeos::disks::DiskMountManager* disk_mount_manager,
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 return; 798 return;
792 if (error_code == chromeos::MOUNT_ERROR_NONE) 799 if (error_code == chromeos::MOUNT_ERROR_NONE)
793 mounted_volumes_.erase(volume_info.volume_id); 800 mounted_volumes_.erase(volume_info.volume_id);
794 801
795 FOR_EACH_OBSERVER(VolumeManagerObserver, 802 FOR_EACH_OBSERVER(VolumeManagerObserver,
796 observers_, 803 observers_,
797 OnVolumeUnmounted(error_code, volume_info)); 804 OnVolumeUnmounted(error_code, volume_info));
798 } 805 }
799 806
800 } // namespace file_manager 807 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/volume_manager.h ('k') | chrome/common/extensions/api/file_manager_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698