Chromium Code Reviews| Index: chrome/browser/system_monitor/media_storage_util_chromeos.cc |
| diff --git a/chrome/browser/system_monitor/media_storage_util_linux.cc b/chrome/browser/system_monitor/media_storage_util_chromeos.cc |
| similarity index 56% |
| copy from chrome/browser/system_monitor/media_storage_util_linux.cc |
| copy to chrome/browser/system_monitor/media_storage_util_chromeos.cc |
| index 87e5eda410cf635fb04bfa16484cf2ecedfd9c8d..2eef8349ffedfb1bb77c5c2e663afdc445333c8f 100644 |
| --- a/chrome/browser/system_monitor/media_storage_util_linux.cc |
| +++ b/chrome/browser/system_monitor/media_storage_util_chromeos.cc |
| @@ -2,26 +2,41 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -// Linux specific implementation of chrome::MediaStorageUtil. |
| +// Chrome OS specific implementation of chrome::MediaStorageUtil. |
|
kmadhusu
2012/09/16 22:35:42
Do not review this file. Just uploaded for referen
vandebo (ex-Chrome)
2012/09/16 23:03:19
You can remove it now, since it's still in the pre
|
| #include "chrome/browser/system_monitor/media_storage_util.h" |
| -#include "base/callback.h" |
| +#include "base/file_path.h" |
| +#include "base/string16.h" |
| #include "base/system_monitor/system_monitor.h" |
| -#include "chrome/browser/system_monitor/removable_device_notifications_linux.h" |
| +#include "chrome/browser/system_monitor/media_transfer_protocol_device_observer_chromeos.h" |
| +#include "chrome/browser/system_monitor/removable_device_notifications_chromeos.h" |
| namespace chrome { |
| +using base::SystemMonitor; |
| +using chromeos::mtp::MediaTransferProtocolDeviceObserverCros; |
| +using chromeos::RemovableDeviceNotificationsCros; |
| + |
| // static |
| bool MediaStorageUtil::GetDeviceInfoFromPathImpl(const FilePath& path, |
| std::string* device_id, |
| string16* device_name, |
| FilePath* relative_path) { |
| - RemovableDeviceNotificationsLinux* device_tracker = |
| - RemovableDeviceNotificationsLinux::GetInstance(); |
| - DCHECK(device_tracker); |
| + // Check if the |path| belongs to a removable mass storage device. |
| + RemovableDeviceNotificationsCros* mass_storage_tracker = |
| + RemovableDeviceNotificationsCros::GetInstance(); |
| + DCHECK(mass_storage_tracker); |
| base::SystemMonitor::RemovableStorageInfo device_info; |
| - bool found_device = device_tracker->GetDeviceInfoForPath(path, &device_info); |
| + bool found_device = mass_storage_tracker->GetDeviceInfoForPath(path, |
| + &device_info); |
| + if (!found_device) { |
| + // Check if the |path| belongs to a mtp storage device. |
| + MediaTransferProtocolDeviceObserverCros * mtp_device_tracker = |
| + MediaTransferProtocolDeviceObserverCros::GetInstance(); |
| + found_device = mtp_device_tracker->GetStorageInfoForPath(path, |
| + &device_info); |
| + } |
| if (found_device && IsRemovableDevice(device_info.device_id)) { |
| if (device_id) |