| Index: chrome/browser/storage_monitor/removable_device_notifications_chromeos.cc
|
| diff --git a/chrome/browser/storage_monitor/removable_device_notifications_chromeos.cc b/chrome/browser/storage_monitor/removable_device_notifications_chromeos.cc
|
| index 9847fc5b1f43fe62aea382b0f596d91c3d354489..58d25dcdebc0c06899406be0fe3853151b127bf2 100644
|
| --- a/chrome/browser/storage_monitor/removable_device_notifications_chromeos.cc
|
| +++ b/chrome/browser/storage_monitor/removable_device_notifications_chromeos.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "chrome/browser/storage_monitor/removable_device_notifications_chromeos.h"
|
|
|
| +#include "base/command_line.h"
|
| #include "base/files/file_path.h"
|
| #include "base/logging.h"
|
| #include "base/stl_util.h"
|
| @@ -14,8 +15,11 @@
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/storage_monitor/media_device_notifications_utils.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 {
|
|
|
| @@ -87,18 +91,35 @@ bool GetDeviceInfo(const std::string& source_path,
|
| using content::BrowserThread;
|
|
|
| RemovableDeviceNotificationsCros::RemovableDeviceNotificationsCros() {
|
| - DCHECK(disks::DiskMountManager::GetInstance());
|
| - disks::DiskMountManager::GetInstance()->AddObserver(this);
|
| - CheckExistingMountPointsOnUIThread();
|
| }
|
|
|
| RemovableDeviceNotificationsCros::~RemovableDeviceNotificationsCros() {
|
| + if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
|
| + device::MediaTransferProtocolManager::Shutdown();
|
| + }
|
| +
|
| disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance();
|
| if (manager) {
|
| manager->RemoveObserver(this);
|
| }
|
| }
|
|
|
| +void RemovableDeviceNotificationsCros::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 RemovableDeviceNotificationsCros::CheckExistingMountPointsOnUIThread() {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| const disks::DiskMountManager::MountPointMap& mount_point_map =
|
|
|