| Index: chrome/browser/storage_monitor/storage_monitor_chromeos.cc
|
| diff --git a/chrome/browser/storage_monitor/storage_monitor_chromeos.cc b/chrome/browser/storage_monitor/storage_monitor_chromeos.cc
|
| index f07a0cf7914fbf6cb260c3ae684c20fcbe4bfda6..a4a6075ac7c9e11a3943133aebfbd574ca3764b1 100644
|
| --- a/chrome/browser/storage_monitor/storage_monitor_chromeos.cc
|
| +++ b/chrome/browser/storage_monitor/storage_monitor_chromeos.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "chrome/browser/storage_monitor/storage_monitor_chromeos.h"
|
|
|
| +#include "base/command_line.h"
|
| #include "base/files/file_path.h"
|
| #include "base/logging.h"
|
| #include "base/stl_util.h"
|
| @@ -13,8 +14,11 @@
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/storage_monitor/media_storage_util.h"
|
| +#include "chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.h"
|
| #include "chrome/browser/storage_monitor/removable_device_constants.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
|
|
|
| namespace chromeos {
|
|
|
| @@ -104,18 +108,34 @@ using content::BrowserThread;
|
| using chrome::StorageInfo;
|
|
|
| StorageMonitorCros::StorageMonitorCros() {
|
| - DCHECK(disks::DiskMountManager::GetInstance());
|
| - disks::DiskMountManager::GetInstance()->AddObserver(this);
|
| - CheckExistingMountPointsOnUIThread();
|
| }
|
|
|
| StorageMonitorCros::~StorageMonitorCros() {
|
| + if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
|
| + device::MediaTransferProtocolManager::Shutdown();
|
| + }
|
| +
|
| disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance();
|
| if (manager) {
|
| manager->RemoveObserver(this);
|
| }
|
| }
|
|
|
| +void StorageMonitorCros::Init() {
|
| + DCHECK(disks::DiskMountManager::GetInstance());
|
| + disks::DiskMountManager::GetInstance()->AddObserver(this);
|
| + CheckExistingMountPointsOnUIThread();
|
| +
|
| + if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
|
| + scoped_refptr<base::MessageLoopProxy> loop_proxy;
|
| + device::MediaTransferProtocolManager::Initialize(loop_proxy);
|
| +
|
| + media_transfer_protocol_device_observer_.reset(
|
| + new chrome::MediaTransferProtocolDeviceObserverLinux());
|
| + media_transfer_protocol_device_observer_->SetNotifications(receiver());
|
| + }
|
| +}
|
| +
|
| void StorageMonitorCros::CheckExistingMountPointsOnUIThread() {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| const disks::DiskMountManager::MountPointMap& mount_point_map =
|
|
|