Chromium Code Reviews| Index: chrome/browser/chromeos/file_manager/volume_manager.cc |
| diff --git a/chrome/browser/chromeos/file_manager/volume_manager.cc b/chrome/browser/chromeos/file_manager/volume_manager.cc |
| index 6f0e6efb1558d216d9478011706d9e3659dd33ac..85c7562eaebb8d98306787eab32e8c24ee5cc5c9 100644 |
| --- a/chrome/browser/chromeos/file_manager/volume_manager.cc |
| +++ b/chrome/browser/chromeos/file_manager/volume_manager.cc |
| @@ -136,7 +136,8 @@ Volume::Volume() |
| mount_context_(MOUNT_CONTEXT_UNKNOWN), |
| is_parent_(false), |
| is_read_only_(false), |
| - has_media_(false) { |
| + has_media_(false), |
| + configurable_(false) { |
|
hirono
2015/05/14 10:43:08
Please also initialize source_.
mtomasz
2015/05/15 02:03:37
Oops. Done.
|
| } |
| Volume::~Volume() { |
| @@ -150,11 +151,9 @@ Volume* Volume::CreateForDrive(Profile* profile) { |
| volume->type_ = VOLUME_TYPE_GOOGLE_DRIVE; |
| volume->device_type_ = chromeos::DEVICE_TYPE_UNKNOWN; |
| volume->source_path_ = drive_path; |
| + volume->source_ = SOURCE_NETWORK; |
| volume->mount_path_ = drive_path; |
| volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE; |
| - volume->is_parent_ = false; |
| - volume->is_read_only_ = false; |
| - volume->has_media_ = false; |
| volume->volume_id_ = GenerateVolumeId(*volume); |
| return volume; |
| } |
| @@ -165,11 +164,9 @@ Volume* Volume::CreateForDownloads(const base::FilePath& downloads_path) { |
| volume->type_ = VOLUME_TYPE_DOWNLOADS_DIRECTORY; |
| volume->device_type_ = chromeos::DEVICE_TYPE_UNKNOWN; |
| // Keep source_path empty. |
| + volume->source_ = SOURCE_SYSTEM; |
| volume->mount_path_ = downloads_path; |
| volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE; |
| - volume->is_parent_ = false; |
| - volume->is_read_only_ = false; |
| - volume->has_media_ = false; |
| volume->volume_id_ = GenerateVolumeId(*volume); |
| return volume; |
| } |
| @@ -181,6 +178,9 @@ Volume* Volume::CreateForRemovable( |
| Volume* const volume = new Volume; |
| volume->type_ = MountTypeToVolumeType(mount_point.mount_type); |
| volume->source_path_ = base::FilePath(mount_point.source_path); |
| + volume->source_ = mount_point.mount_type == chromeos::MOUNT_TYPE_ARCHIVE |
| + ? SOURCE_FILE |
| + : SOURCE_DEVICE; |
| volume->mount_path_ = base::FilePath(mount_point.mount_path); |
| volume->mount_condition_ = mount_point.mount_condition; |
| volume->volume_label_ = volume->mount_path().BaseName().AsUTF8Unsafe(); |
| @@ -192,10 +192,8 @@ Volume* Volume::CreateForRemovable( |
| volume->has_media_ = disk->has_media(); |
| } else { |
| volume->device_type_ = chromeos::DEVICE_TYPE_UNKNOWN; |
| - volume->is_parent_ = false; |
| volume->is_read_only_ = |
| (mount_point.mount_type == chromeos::MOUNT_TYPE_ARCHIVE); |
| - volume->has_media_ = false; |
| } |
| volume->volume_id_ = GenerateVolumeId(*volume); |
| return volume; |
| @@ -209,6 +207,17 @@ Volume* Volume::CreateForProvidedFileSystem( |
| Volume* const volume = new Volume; |
| volume->file_system_id_ = file_system_info.file_system_id(); |
| volume->extension_id_ = file_system_info.extension_id(); |
| + switch (file_system_info.source()) { |
| + case extensions::SOURCE_FILE: |
| + volume->source_ = SOURCE_FILE; |
| + break; |
| + case extensions::SOURCE_DEVICE: |
| + volume->source_ = SOURCE_DEVICE; |
| + break; |
| + case extensions::SOURCE_NETWORK: |
| + volume->source_ = SOURCE_NETWORK; |
| + break; |
| + } |
| volume->volume_label_ = file_system_info.display_name(); |
| volume->type_ = VOLUME_TYPE_PROVIDED; |
| volume->mount_path_ = file_system_info.mount_path(); |
| @@ -216,7 +225,7 @@ Volume* Volume::CreateForProvidedFileSystem( |
| volume->mount_context_ = mount_context; |
| volume->is_parent_ = true; |
| volume->is_read_only_ = !file_system_info.writable(); |
| - volume->has_media_ = false; |
| + volume->configurable_ = file_system_info.configurable(); |
| volume->volume_id_ = GenerateVolumeId(*volume); |
| return volume; |
| } |
| @@ -234,6 +243,7 @@ Volume* Volume::CreateForMTP(const base::FilePath& mount_path, |
| volume->volume_id_ = kMtpVolumeIdPrefix + label; |
| volume->volume_label_ = label; |
| volume->source_path_ = mount_path; |
| + volume->source_ = SOURCE_DEVICE; |
| volume->device_type_ = chromeos::DEVICE_TYPE_MOBILE; |
| return volume; |
| } |
| @@ -247,11 +257,10 @@ Volume* Volume::CreateForTesting(const base::FilePath& path, |
| volume->type_ = volume_type; |
| volume->device_type_ = device_type; |
| // Keep source_path empty. |
| + volume->source_ = SOURCE_DEVICE; |
| volume->mount_path_ = path; |
| volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE; |
| - volume->is_parent_ = false; |
| volume->is_read_only_ = read_only; |
| - volume->has_media_ = false; |
| volume->volume_id_ = GenerateVolumeId(*volume); |
| return volume; |
| } |
| @@ -421,6 +430,11 @@ void VolumeManager::AddVolumeForTesting(const base::FilePath& path, |
| path, volume_type, device_type, read_only))); |
| } |
| +void VolumeManager::AddVolumeForTesting(linked_ptr<Volume> volume) { |
| + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| + DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume); |
| +} |
| + |
| void VolumeManager::OnFileSystemMounted() { |
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |