| Index: chrome/browser/extensions/api/system_info_storage/storage_info_provider.cc
|
| diff --git a/chrome/browser/extensions/api/system_info_storage/storage_info_provider.cc b/chrome/browser/extensions/api/system_info_storage/storage_info_provider.cc
|
| index 56a7b290d9b9a04261b3a748245e622ca52a6aa9..9e72bea2efd27c56f0531590608a7b8cb2b2e771 100644
|
| --- a/chrome/browser/extensions/api/system_info_storage/storage_info_provider.cc
|
| +++ b/chrome/browser/extensions/api/system_info_storage/storage_info_provider.cc
|
| @@ -5,6 +5,7 @@
|
| #include "chrome/browser/extensions/api/system_info_storage/storage_info_provider.h"
|
|
|
| namespace extensions {
|
| +
|
| namespace systeminfo {
|
|
|
| const char kStorageTypeUnknown[] = "unknown";
|
| @@ -12,4 +13,47 @@ const char kStorageTypeHardDisk[] = "harddisk";
|
| const char kStorageTypeRemovable[] = "removable";
|
|
|
| } // namespace systeminfo
|
| +
|
| +using api::experimental_system_info_storage::StorageInfo;
|
| +using api::experimental_system_info_storage::StorageUnitInfo;
|
| +using content::BrowserThread;
|
| +
|
| +StorageInfoProvider::StorageInfoProvider()
|
| + : delegate_(NULL),
|
| + is_watching_(false) {
|
| +}
|
| +
|
| +StorageInfoProvider::~StorageInfoProvider() {
|
| + DCHECK(is_watching_) << "Need to call StopWatching before destroying!";
|
| +}
|
| +
|
| +bool StorageInfoProvider::StartWatching(Delegate* delegate) {
|
| + // Since it always needs a message loop for device notification, we post
|
| + // the watching task to File thread instead of the worker pool.
|
| + bool success =
|
| + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(
|
| + base::IgnoreResult(&StorageInfoProvider::PlatformStartWatching),
|
| + base::Unretained(this), delegate));
|
| +
|
| + return success;
|
| +}
|
| +
|
| +bool StorageInfoProvider::StopWatching() {
|
| + bool success =
|
| + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(
|
| + base::IgnoreResult(&StorageInfoProvider::PlatformStopWatching),
|
| + base::Unretained(this)));
|
| +
|
| + return success;
|
| +}
|
| +
|
| +void StorageInfoProvider::OnMediaDeviceAttached(const std::string& id,
|
| + const string16& name, const FilePath::StringType& location) {
|
| + // TODO(hongbo): Handle the event of a new storage device attached.
|
| +}
|
| +
|
| +void StorageInfoProvider::OnMediaDeviceDetached(const std::string& id) {
|
| + // TODO(hongbo): Handle the event of a storage device detached.
|
| +}
|
| +
|
| } // namespace extensions
|
|
|