| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Linux specific implementation of chrome::MediaStorageUtil. | 5 // Linux specific implementation of chrome::MediaStorageUtil. |
| 6 | 6 |
| 7 #include "chrome/browser/media_gallery/media_storage_util.h" | 7 #include "chrome/browser/system_monitor/media_storage_util.h" |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/system_monitor/system_monitor.h" | 10 #include "base/system_monitor/system_monitor.h" |
| 11 #include "chrome/browser/media_gallery/removable_device_notifications_linux.h" | 11 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" |
| 12 | 12 |
| 13 namespace chrome { | 13 namespace chrome { |
| 14 | 14 |
| 15 // static | 15 // static |
| 16 void MediaStorageUtil::GetDeviceInfoFromPath( | 16 void MediaStorageUtil::GetDeviceInfoFromPath( |
| 17 const FilePath& path, const DeviceInfoCallback& callback) { | 17 const FilePath& path, const DeviceInfoCallback& callback) { |
| 18 RemovableDeviceNotificationsLinux* device_tracker = | 18 RemovableDeviceNotificationsLinux* device_tracker = |
| 19 RemovableDeviceNotificationsLinux::GetInstance(); | 19 RemovableDeviceNotificationsLinux::GetInstance(); |
| 20 DCHECK(device_tracker); | 20 DCHECK(device_tracker); |
| 21 base::SystemMonitor::RemovableStorageInfo device_info; | 21 base::SystemMonitor::RemovableStorageInfo device_info; |
| 22 bool found_device = device_tracker->GetDeviceInfoForPath(path, &device_info); | 22 bool found_device = device_tracker->GetDeviceInfoForPath(path, &device_info); |
| 23 | 23 |
| 24 FilePath relative_path; | 24 FilePath relative_path; |
| 25 if (found_device && IsRemovableDevice(device_info.device_id)) { | 25 if (found_device && IsRemovableDevice(device_info.device_id)) { |
| 26 FilePath mount_point(device_info.location); | 26 FilePath mount_point(device_info.location); |
| 27 mount_point.AppendRelativePath(path, &relative_path); | 27 mount_point.AppendRelativePath(path, &relative_path); |
| 28 } else { | 28 } else { |
| 29 device_info.device_id = | 29 device_info.device_id = |
| 30 MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); | 30 MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); |
| 31 device_info.name = path.BaseName().LossyDisplayName(); | 31 device_info.name = path.BaseName().LossyDisplayName(); |
| 32 } | 32 } |
| 33 callback.Run(device_info.device_id, relative_path, device_info.name); | 33 callback.Run(device_info.device_id, relative_path, device_info.name); |
| 34 } | 34 } |
| 35 | 35 |
| 36 } // namespace chrome | 36 } // namespace chrome |
| OLD | NEW |