| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Linux specific implementation of chrome::MediaStorageUtil. | |
| 6 | |
| 7 #include "chrome/browser/media_gallery/media_storage_util.h" | |
| 8 | |
| 9 #include "base/callback.h" | |
| 10 #include "base/system_monitor/system_monitor.h" | |
| 11 #include "chrome/browser/media_gallery/removable_device_notifications_linux.h" | |
| 12 | |
| 13 namespace chrome { | |
| 14 | |
| 15 // static | |
| 16 void MediaStorageUtil::GetDeviceInfoFromPath( | |
| 17 const FilePath& path, const DeviceInfoCallback& callback) { | |
| 18 RemovableDeviceNotificationsLinux* device_tracker = | |
| 19 RemovableDeviceNotificationsLinux::GetInstance(); | |
| 20 DCHECK(device_tracker); | |
| 21 base::SystemMonitor::RemovableStorageInfo device_info; | |
| 22 bool found_device = device_tracker->GetDeviceInfoForPath(path, &device_info); | |
| 23 | |
| 24 FilePath relative_path; | |
| 25 if (found_device && IsRemovableDevice(device_info.device_id)) { | |
| 26 FilePath mount_point(device_info.location); | |
| 27 mount_point.AppendRelativePath(path, &relative_path); | |
| 28 } else { | |
| 29 device_info.device_id = | |
| 30 MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); | |
| 31 device_info.name = path.BaseName().LossyDisplayName(); | |
| 32 } | |
| 33 callback.Run(device_info.device_id, relative_path, device_info.name); | |
| 34 } | |
| 35 | |
| 36 } // namespace chrome | |
| OLD | NEW |