| 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 94%
|
| rename from chrome/browser/storage_monitor/removable_device_notifications_linux.cc
|
| rename to chrome/browser/storage_monitor/storage_monitor_linux.cc
|
| index db6ef69c67d59aeb18271830f24244a9dd3a3ac4..cdfb15ef8ce6f3501a343540635540fe4cf135bc 100644
|
| --- a/chrome/browser/storage_monitor/removable_device_notifications_linux.cc
|
| +++ b/chrome/browser/storage_monitor/storage_monitor_linux.cc
|
| @@ -4,7 +4,7 @@
|
|
|
| // RemovableDeviceNotificationsLinux 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)
|
| : initialized_(false),
|
| mtab_path_(path),
|
| get_device_info_func_(&GetDeviceInfo) {
|
| }
|
|
|
| -RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux(
|
| +StorageMonitorLinux::StorageMonitorLinux(
|
| const base::FilePath& path,
|
| GetDeviceInfoFunc get_device_info_func)
|
| : 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 {
|
| if (!path.IsAbsolute())
|
| @@ -277,7 +277,7 @@ bool RemovableDeviceNotificationsLinux::GetStorageInfoForPath(
|
| return true;
|
| }
|
|
|
| -uint64 RemovableDeviceNotificationsLinux::GetStorageSize(
|
| +uint64 StorageMonitorLinux::GetStorageSize(
|
| const std::string& location) const {
|
| 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,
|
| bool error) {
|
| if (path != mtab_path_) {
|
| @@ -302,11 +302,11 @@ 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;
|
| @@ -316,7 +316,7 @@ void RemovableDeviceNotificationsLinux::InitOnFileThread() {
|
| // 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);
|
|
|