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..3ec26e5faba5e86fd4ce2c05ea498d2c2fd7cc1c 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,33 @@ bool GetDeviceInfo(const std::string& source_path, |
using content::BrowserThread; |
RemovableDeviceNotificationsCros::RemovableDeviceNotificationsCros() { |
- DCHECK(disks::DiskMountManager::GetInstance()); |
- disks::DiskMountManager::GetInstance()->AddObserver(this); |
- CheckExistingMountPointsOnUIThread(); |
} |
RemovableDeviceNotificationsCros::~RemovableDeviceNotificationsCros() { |
+ device::MediaTransferProtocolManager::Shutdown(); |
Lei Zhang
2013/03/01 04:40:15
Add a check before calling this to avoid the shutd
Greg Billock
2013/03/01 18:00:50
Done.
|
+ |
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 = |