| Index: chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.cc
|
| ===================================================================
|
| --- chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.cc (revision 193280)
|
| +++ chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.cc (working copy)
|
| @@ -24,6 +24,10 @@
|
| // Device root path constant.
|
| const char kRootPath[] = "/";
|
|
|
| +device::MediaTransferProtocolManager* GetMediaTransferProtocolManager() {
|
| + return StorageMonitor::GetInstance()->media_transfer_protocol_manager();
|
| +}
|
| +
|
| // Constructs and returns the location of the device using the |storage_name|.
|
| std::string GetDeviceLocationFromStorageName(const std::string& storage_name) {
|
| // Construct a dummy device path using the storage name. This is only used
|
| @@ -101,10 +105,8 @@
|
| string16* label,
|
| std::string* location) {
|
| DCHECK(!storage_name.empty());
|
| - device::MediaTransferProtocolManager* mtp_manager =
|
| - device::MediaTransferProtocolManager::GetInstance();
|
| const MtpStorageInfo* storage_info =
|
| - mtp_manager->GetStorageInfo(storage_name);
|
| + GetMediaTransferProtocolManager()->GetStorageInfo(storage_name);
|
|
|
| if (!storage_info)
|
| return;
|
| @@ -128,10 +130,7 @@
|
| DCHECK(!g_mtp_device_observer);
|
| g_mtp_device_observer = this;
|
|
|
| - device::MediaTransferProtocolManager* mtp_manager =
|
| - device::MediaTransferProtocolManager::GetInstance();
|
| - DCHECK(mtp_manager);
|
| - mtp_manager->AddObserver(this);
|
| + GetMediaTransferProtocolManager()->AddObserver(this);
|
| EnumerateStorages();
|
| }
|
|
|
| @@ -151,10 +150,7 @@
|
| DCHECK_EQ(this, g_mtp_device_observer);
|
| g_mtp_device_observer = NULL;
|
|
|
| - device::MediaTransferProtocolManager* mtp_manager =
|
| - device::MediaTransferProtocolManager::GetInstance();
|
| - if (mtp_manager)
|
| - mtp_manager->RemoveObserver(this);
|
| + GetMediaTransferProtocolManager()->RemoveObserver(this);
|
| }
|
|
|
| bool MediaTransferProtocolDeviceObserverLinux::GetStorageInfoForPath(
|
| @@ -219,9 +215,7 @@
|
|
|
| void MediaTransferProtocolDeviceObserverLinux::EnumerateStorages() {
|
| typedef std::vector<std::string> StorageList;
|
| - device::MediaTransferProtocolManager* mtp_manager =
|
| - device::MediaTransferProtocolManager::GetInstance();
|
| - StorageList storages = mtp_manager->GetStorages();
|
| + StorageList storages = GetMediaTransferProtocolManager()->GetStorages();
|
| for (StorageList::const_iterator storage_iter = storages.begin();
|
| storage_iter != storages.end(); ++storage_iter) {
|
| StorageChanged(true, *storage_iter);
|
|
|