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 bc05c900930a5cf5162eb3a0caa3e90c9fc298a4..e64f620825d7472e1b5fd1974caf96e2fe1f75da 100644 |
--- a/chrome/browser/chromeos/file_manager/volume_manager.cc |
+++ b/chrome/browser/chromeos/file_manager/volume_manager.cc |
@@ -16,7 +16,6 @@ |
#include "chrome/browser/chromeos/drive/drive_integration_service.h" |
#include "chrome/browser/chromeos/drive/file_system_interface.h" |
#include "chrome/browser/chromeos/drive/file_system_util.h" |
-#include "chrome/browser/chromeos/file_manager/mounted_disk_monitor.h" |
#include "chrome/browser/chromeos/file_manager/path_util.h" |
#include "chrome/browser/chromeos/file_manager/snapshot_manager.h" |
#include "chrome/browser/chromeos/file_manager/volume_manager_factory.h" |
@@ -38,9 +37,6 @@ |
namespace file_manager { |
namespace { |
-// A named constant to be passed to the |is_remounting| parameter. |
-const bool kNotRemounting = false; |
- |
const char kFileManagerMTPMountNamePrefix[] = "fileman-mtp-"; |
const char kMtpVolumeIdPrefix [] = "mtp:"; |
@@ -255,7 +251,6 @@ VolumeManager::VolumeManager( |
: profile_(profile), |
drive_integration_service_(drive_integration_service), |
disk_mount_manager_(disk_mount_manager), |
- mounted_disk_monitor_(new MountedDiskMonitor(power_manager_client)), |
file_system_provider_service_(file_system_provider_service), |
snapshot_manager_(new SnapshotManager(profile_)), |
weak_ptr_factory_(this) { |
@@ -296,16 +291,14 @@ void VolumeManager::Initialize() { |
DCHECK(success); |
DoMountEvent(chromeos::MOUNT_ERROR_NONE, |
- CreateDownloadsVolumeInfo(downloads), |
- kNotRemounting); |
+ CreateDownloadsVolumeInfo(downloads)); |
// Subscribe to DriveIntegrationService. |
if (drive_integration_service_) { |
drive_integration_service_->AddObserver(this); |
if (drive_integration_service_->IsMounted()) { |
DoMountEvent(chromeos::MOUNT_ERROR_NONE, |
- CreateDriveVolumeInfo(profile_), |
- kNotRemounting); |
+ CreateDriveVolumeInfo(profile_)); |
} |
} |
@@ -326,7 +319,7 @@ void VolumeManager::Initialize() { |
for (size_t i = 0; i < file_system_info_list.size(); ++i) { |
VolumeInfo volume_info = |
CreateProvidedFileSystemVolumeInfo(file_system_info_list[i]); |
- DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info, kNotRemounting); |
+ DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info); |
} |
} |
@@ -424,8 +417,7 @@ bool VolumeManager::RegisterDownloadsDirectoryForTesting( |
bool success = RegisterDownloadsMountPoint(profile_, path); |
DoMountEvent( |
success ? chromeos::MOUNT_ERROR_NONE : chromeos::MOUNT_ERROR_INVALID_PATH, |
- CreateDownloadsVolumeInfo(path), |
- kNotRemounting); |
+ CreateDownloadsVolumeInfo(path)); |
return success; |
} |
@@ -434,8 +426,7 @@ void VolumeManager::AddVolumeInfoForTesting(const base::FilePath& path, |
chromeos::DeviceType device_type) { |
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
DoMountEvent(chromeos::MOUNT_ERROR_NONE, |
- CreateTestingVolumeInfo(path, volume_type, device_type), |
- kNotRemounting); |
+ CreateTestingVolumeInfo(path, volume_type, device_type)); |
} |
void VolumeManager::OnFileSystemMounted() { |
@@ -445,7 +436,7 @@ void VolumeManager::OnFileSystemMounted() { |
// We can pass chromeos::MOUNT_ERROR_NONE even when authentication is failed |
// or network is unreachable. These two errors will be handled later. |
VolumeInfo volume_info = CreateDriveVolumeInfo(profile_); |
- DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info, kNotRemounting); |
+ DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info); |
} |
void VolumeManager::OnFileSystemBeingUnmounted() { |
@@ -460,8 +451,6 @@ void VolumeManager::OnDiskEvent( |
const chromeos::disks::DiskMountManager::Disk* disk) { |
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
- mounted_disk_monitor_->OnDiskEvent(event, disk); |
- |
// Disregard hidden devices. |
if (disk->is_hidden()) |
return; |
@@ -506,11 +495,6 @@ void VolumeManager::OnDiskEvent( |
// Notify to observers. |
FOR_EACH_OBSERVER(VolumeManagerObserver, observers_, |
OnDiskRemoved(*disk)); |
- const std::string& device_path = disk->system_path_prefix(); |
- if (mounted_disk_monitor_->DeviceIsHardUnpluggedButNotReported( |
- device_path)) { |
- mounted_disk_monitor_->MarkAsHardUnpluggedReported(device_path); |
- } |
return; |
} |
NOTREACHED(); |
@@ -521,8 +505,6 @@ void VolumeManager::OnDeviceEvent( |
const std::string& device_path) { |
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
- mounted_disk_monitor_->OnDeviceEvent(event, device_path); |
- |
DVLOG(1) << "OnDeviceEvent: " << event << ", " << device_path; |
switch (event) { |
case chromeos::disks::DiskMountManager::DEVICE_ADDED: |
@@ -548,10 +530,6 @@ void VolumeManager::OnMountEvent( |
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
DCHECK_NE(chromeos::MOUNT_TYPE_INVALID, mount_info.mount_type); |
- const chromeos::disks::DiskMountManager::Disk* disk = |
- disk_mount_manager_->FindDiskBySourcePath(mount_info.source_path); |
- mounted_disk_monitor_->OnMountEvent(event, error_code, mount_info, disk); |
- |
if (mount_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) { |
// If the file is not mounted now, tell it to drive file system so that |
// it can handle file caching correctly. |
@@ -561,7 +539,7 @@ void VolumeManager::OnMountEvent( |
error_code != chromeos::MOUNT_ERROR_NONE) || |
(event == chromeos::disks::DiskMountManager::UNMOUNTING && |
error_code == chromeos::MOUNT_ERROR_NONE)) { |
- drive::FileSystemInterface* file_system = |
+ drive::FileSystemInterface* const file_system = |
drive::util::GetFileSystemByProfile(profile_); |
if (file_system) { |
file_system->MarkCacheFileAsUnmounted( |
@@ -572,13 +550,13 @@ void VolumeManager::OnMountEvent( |
} |
// Notify a mounting/unmounting event to observers. |
- VolumeInfo volume_info = |
+ const chromeos::disks::DiskMountManager::Disk* const disk = |
+ disk_mount_manager_->FindDiskBySourcePath(mount_info.source_path); |
+ const VolumeInfo volume_info = |
CreateVolumeInfoFromMountPointInfo(mount_info, disk); |
switch (event) { |
case chromeos::disks::DiskMountManager::MOUNTING: { |
- bool is_remounting = |
- disk && mounted_disk_monitor_->DiskIsRemounting(*disk); |
- DoMountEvent(error_code, volume_info, is_remounting); |
+ DoMountEvent(error_code, volume_info); |
return; |
} |
case chromeos::disks::DiskMountManager::UNMOUNTING: |
@@ -634,7 +612,7 @@ void VolumeManager::OnProvidedFileSystemMount( |
const chromeos::MountError mount_error = error == base::File::FILE_OK |
? chromeos::MOUNT_ERROR_NONE |
: chromeos::MOUNT_ERROR_UNKNOWN; |
- DoMountEvent(mount_error, volume_info, kNotRemounting); |
+ DoMountEvent(mount_error, volume_info); |
} |
void VolumeManager::OnProvidedFileSystemUnmount( |
@@ -674,7 +652,7 @@ void VolumeManager::OnPrivetVolumesAvailable( |
for (local_discovery::PrivetVolumeLister::VolumeList::const_iterator i = |
volumes.begin(); i != volumes.end(); i++) { |
VolumeInfo volume_info = CreatePrivetVolumeInfo(*i); |
- DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info, false); |
+ DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info); |
} |
} |
@@ -717,7 +695,7 @@ void VolumeManager::OnRemovableStorageAttached( |
volume_info.volume_label = label; |
volume_info.source_path = path; |
volume_info.device_type = chromeos::DEVICE_TYPE_MOBILE; |
- DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info, false); |
+ DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info); |
} |
void VolumeManager::OnRemovableStorageDetached( |
@@ -765,8 +743,7 @@ void VolumeManager::OnDiskMountManagerRefreshed(bool success) { |
chromeos::MOUNT_ERROR_NONE, |
CreateVolumeInfoFromMountPointInfo( |
it->second, |
- disk_mount_manager_->FindDiskBySourcePath(it->second.source_path)), |
- kNotRemounting); |
+ disk_mount_manager_->FindDiskBySourcePath(it->second.source_path))); |
} |
// We mount archives only if they are opened from currently mounted volumes. |
@@ -792,7 +769,7 @@ void VolumeManager::OnDiskMountManagerRefreshed(bool success) { |
// Mount from the tail of chain. |
for (size_t i = chain.size(); i > 0; --i) |
- DoMountEvent(chromeos::MOUNT_ERROR_NONE, chain[i - 1], kNotRemounting); |
+ DoMountEvent(chromeos::MOUNT_ERROR_NONE, chain[i - 1]); |
} |
} |
@@ -805,8 +782,7 @@ void VolumeManager::OnStorageMonitorInitialized() { |
} |
void VolumeManager::DoMountEvent(chromeos::MountError error_code, |
- const VolumeInfo& volume_info, |
- bool is_remounting) { |
+ const VolumeInfo& volume_info) { |
// Archive files are mounted globally in system. We however don't want to show |
// archives from profile-specific folders (Drive/Downloads) of other users in |
// multi-profile session. To this end, we filter out archives not on the |
@@ -835,16 +811,15 @@ void VolumeManager::DoMountEvent(chromeos::MountError error_code, |
if (error_code == chromeos::MOUNT_ERROR_NONE || volume_info.mount_condition) { |
mounted_volumes_[volume_info.volume_id] = volume_info; |
- if (!is_remounting) { |
- UMA_HISTOGRAM_ENUMERATION("FileBrowser.VolumeType", |
- volume_info.type, |
- NUM_VOLUME_TYPE); |
- } |
+ |
+ UMA_HISTOGRAM_ENUMERATION("FileBrowser.VolumeType", |
+ volume_info.type, |
+ NUM_VOLUME_TYPE); |
} |
FOR_EACH_OBSERVER(VolumeManagerObserver, |
observers_, |
- OnVolumeMounted(error_code, volume_info, is_remounting)); |
+ OnVolumeMounted(error_code, volume_info)); |
} |
void VolumeManager::DoUnmountEvent(chromeos::MountError error_code, |