Chromium Code Reviews| Index: chrome/browser/storage_monitor/storage_monitor_linux.cc |
| diff --git a/chrome/browser/storage_monitor/removable_device_notifications_linux.cc b/chrome/browser/storage_monitor/storage_monitor_linux.cc |
| similarity index 93% |
| rename from chrome/browser/storage_monitor/removable_device_notifications_linux.cc |
| rename to chrome/browser/storage_monitor/storage_monitor_linux.cc |
| index db6ef69c67d59aeb18271830f24244a9dd3a3ac4..b179b2172f685f0fb76e3b40464c3a7b338d9088 100644 |
| --- a/chrome/browser/storage_monitor/removable_device_notifications_linux.cc |
| +++ b/chrome/browser/storage_monitor/storage_monitor_linux.cc |
| @@ -2,9 +2,9 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -// RemovableDeviceNotificationsLinux implementation. |
| +// StorageMonitorLinux implementation. |
| -#include "chrome/browser/storage_monitor/removable_device_notifications_linux.h" |
| +#include "chrome/browser/storage_monitor/storage_monitor_linux.h" |
| #include <mntent.h> |
| #include <stdio.h> |
| @@ -224,14 +224,14 @@ void GetDeviceInfo(const base::FilePath& device_path, |
| } // namespace |
| -RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( |
| +StorageMonitorLinux::StorageMonitorLinux( |
| const base::FilePath& path) |
|
vandebo (ex-Chrome)
2013/03/02 00:23:37
nit: line wrap
|
| : initialized_(false), |
| mtab_path_(path), |
| get_device_info_func_(&GetDeviceInfo) { |
| } |
| -RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( |
| +StorageMonitorLinux::StorageMonitorLinux( |
| const base::FilePath& path, |
| GetDeviceInfoFunc get_device_info_func) |
|
vandebo (ex-Chrome)
2013/03/02 00:23:37
nit: line wrap.
|
| : initialized_(false), |
| @@ -239,11 +239,11 @@ RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( |
| get_device_info_func_(get_device_info_func) { |
| } |
| -RemovableDeviceNotificationsLinux::~RemovableDeviceNotificationsLinux() { |
| +StorageMonitorLinux::~StorageMonitorLinux() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| } |
| -void RemovableDeviceNotificationsLinux::Init() { |
| +void StorageMonitorLinux::Init() { |
| DCHECK(!mtab_path_.empty()); |
| // Put |kKnownFileSystems| in std::set to get O(log N) access time. |
| @@ -252,10 +252,10 @@ void RemovableDeviceNotificationsLinux::Init() { |
| BrowserThread::PostTask( |
| BrowserThread::FILE, FROM_HERE, |
| - base::Bind(&RemovableDeviceNotificationsLinux::InitOnFileThread, this)); |
| + base::Bind(&StorageMonitorLinux::InitOnFileThread, this)); |
| } |
| -bool RemovableDeviceNotificationsLinux::GetStorageInfoForPath( |
| +bool StorageMonitorLinux::GetStorageInfoForPath( |
| const base::FilePath& path, |
| StorageInfo* device_info) const { |
|
vandebo (ex-Chrome)
2013/03/02 00:23:37
nit: line wrap.
tommycli
2013/03/04 19:15:09
Wasn't able to rewrap in a reasonable way. The res
|
| if (!path.IsAbsolute()) |
| @@ -277,7 +277,7 @@ bool RemovableDeviceNotificationsLinux::GetStorageInfoForPath( |
| return true; |
| } |
| -uint64 RemovableDeviceNotificationsLinux::GetStorageSize( |
| +uint64 StorageMonitorLinux::GetStorageSize( |
| const std::string& location) const { |
|
vandebo (ex-Chrome)
2013/03/02 00:23:37
nit: line wrap.
|
| MountMap::const_iterator mount_info = mount_info_map_.find( |
| base::FilePath(location)); |
| @@ -285,7 +285,7 @@ uint64 RemovableDeviceNotificationsLinux::GetStorageSize( |
| mount_info->second.partition_size_in_bytes : 0; |
| } |
| -void RemovableDeviceNotificationsLinux::OnFilePathChanged( |
| +void StorageMonitorLinux::OnFilePathChanged( |
| const base::FilePath& path, |
|
vandebo (ex-Chrome)
2013/03/02 00:23:37
nit: line wrap.
tommycli
2013/03/04 19:15:09
The other rewraps were good. Sorry I missed these.
|
| bool error) { |
| if (path != mtab_path_) { |
| @@ -302,21 +302,21 @@ void RemovableDeviceNotificationsLinux::OnFilePathChanged( |
| UpdateMtab(); |
| } |
| -RemovableDeviceNotificationsLinux::MountPointInfo::MountPointInfo() |
| +StorageMonitorLinux::MountPointInfo::MountPointInfo() |
| : partition_size_in_bytes(0) { |
| } |
| -void RemovableDeviceNotificationsLinux::InitOnFileThread() { |
| +void StorageMonitorLinux::InitOnFileThread() { |
| DCHECK(!initialized_); |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| initialized_ = true; |
| // The callback passed to Watch() has to be unretained. Otherwise |
| - // RemovableDeviceNotificationsLinux will live longer than expected, and |
| - // FilePathWatcher will get in trouble at shutdown time. |
| + // StorageMonitorLinux will live longer than expected, and FilePathWatcher |
| + // will get in trouble at shutdown time. |
| bool ret = file_watcher_.Watch( |
| mtab_path_, false, |
| - base::Bind(&RemovableDeviceNotificationsLinux::OnFilePathChanged, |
| + base::Bind(&StorageMonitorLinux::OnFilePathChanged, |
| base::Unretained(this))); |
| if (!ret) { |
| LOG(ERROR) << "Adding watch for " << mtab_path_.value() << " failed"; |
| @@ -326,7 +326,7 @@ void RemovableDeviceNotificationsLinux::InitOnFileThread() { |
| UpdateMtab(); |
| } |
| -void RemovableDeviceNotificationsLinux::UpdateMtab() { |
| +void StorageMonitorLinux::UpdateMtab() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| MountPointDeviceMap new_mtab; |
| @@ -408,7 +408,7 @@ void RemovableDeviceNotificationsLinux::UpdateMtab() { |
| } |
| } |
| -void RemovableDeviceNotificationsLinux::AddNewMount( |
| +void StorageMonitorLinux::AddNewMount( |
| const base::FilePath& mount_device, const base::FilePath& mount_point) { |
| MountPriorityMap::iterator priority = |
| mount_priority_map_.find(mount_device); |