| Index: chrome/browser/chromeos/cros/mount_library.cc
|
| diff --git a/chrome/browser/chromeos/cros/mount_library.cc b/chrome/browser/chromeos/cros/mount_library.cc
|
| index 12f969b6401d5d05acecb51449d6f21bca5a18fb..6ec0d07d6e8b462139bc0dfc003e137bdbb107a2 100644
|
| --- a/chrome/browser/chromeos/cros/mount_library.cc
|
| +++ b/chrome/browser/chromeos/cros/mount_library.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include <set>
|
| #include <vector>
|
| +#include <sys/statvfs.h>
|
|
|
| #include "base/message_loop.h"
|
| #include "base/string_util.h"
|
| @@ -210,6 +211,25 @@ class MountLibraryImpl : public MountLibrary {
|
| this);
|
| }
|
|
|
| + virtual void GetSizeStatsOnFileThread(const char* mount_path,
|
| + size_t* total_size_kb, size_t* remaining_size_kb) OVERRIDE {
|
| + CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| +
|
| + uint64_t total_size_uint64 = 0;
|
| + uint64_t remaining_size_uint64 = 0;
|
| +
|
| + struct statvfs stat;
|
| + if (statvfs(mount_path, &stat) == 0) {
|
| + total_size_uint64 =
|
| + static_cast<uint64_t>(stat.f_blocks) * stat.f_frsize;
|
| + remaining_size_uint64 =
|
| + static_cast<uint64_t>(stat.f_bfree) * stat.f_frsize;
|
| + }
|
| +
|
| + *total_size_kb = static_cast<size_t>(total_size_uint64 / 1024);
|
| + *remaining_size_kb = static_cast<size_t>(remaining_size_uint64 / 1024);
|
| + }
|
| +
|
| virtual void FormatUnmountedDevice(const char* file_path) OVERRIDE {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| if (!CrosLibrary::Get()->EnsureLoaded()) {
|
| @@ -803,6 +823,8 @@ class MountLibraryStubImpl : public MountLibrary {
|
| virtual void MountPath(const char* source_path, MountType type,
|
| const MountPathOptions& options) OVERRIDE {}
|
| virtual void UnmountPath(const char* mount_path) OVERRIDE {}
|
| + virtual void GetSizeStatsOnFileThread(const char* mount_path,
|
| + size_t* total_size_kb, size_t* remaining_size_kb) OVERRIDE {}
|
| virtual void FormatUnmountedDevice(const char* device_path) OVERRIDE {}
|
| virtual void FormatMountedDevice(const char* mount_path) OVERRIDE {}
|
| virtual void UnmountDeviceRecursive(const char* device_path,
|
|
|