Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: chrome/browser/media_gallery/media_storage_util_linux.cc

Issue 10919051: Move device notification impl out of chrome/browser/media_gallery (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698