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

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

Issue 10911234: Update Windows System Monitor Removable Device Impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win compile 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 | Annotate | Revision Log
OLDNEW
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/system_monitor/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/system_monitor/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::GetDeviceInfoFromPathImpl(const FilePath& path, 16 bool MediaStorageUtil::GetDeviceInfoFromPathImpl(const FilePath& path,
17 std::string* device_id, 17 std::string* device_id,
18 string16* device_name, 18 string16* device_name,
19 FilePath* relative_path) { 19 FilePath* relative_path) {
20 RemovableDeviceNotificationsLinux* device_tracker = 20 RemovableDeviceNotificationsLinux* device_tracker =
21 RemovableDeviceNotificationsLinux::GetInstance(); 21 RemovableDeviceNotificationsLinux::GetInstance();
22 DCHECK(device_tracker); 22 DCHECK(device_tracker);
23 base::SystemMonitor::RemovableStorageInfo device_info; 23 base::SystemMonitor::RemovableStorageInfo device_info;
24 bool found_device = device_tracker->GetDeviceInfoForPath(path, &device_info); 24 bool found_device = device_tracker->GetDeviceInfoForPath(path, &device_info);
25 25
26 if (found_device && IsRemovableDevice(device_info.device_id)) { 26 if (found_device && IsRemovableDevice(device_info.device_id)) {
27 if (device_id) 27 if (device_id)
28 *device_id = device_info.device_id; 28 *device_id = device_info.device_id;
29 if (device_name) 29 if (device_name)
30 *device_name = device_info.name; 30 *device_name = device_info.name;
31 if (relative_path) { 31 if (relative_path) {
32 *relative_path = FilePath(); 32 *relative_path = FilePath();
33 FilePath mount_point(device_info.location); 33 FilePath mount_point(device_info.location);
34 mount_point.AppendRelativePath(path, relative_path); 34 mount_point.AppendRelativePath(path, relative_path);
35 } 35 }
36 return; 36 return true;
37 } 37 }
38 38
39 if (device_id) 39 if (device_id)
40 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); 40 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe());
41 if (device_name) 41 if (device_name)
42 *device_name = path.BaseName().LossyDisplayName(); 42 *device_name = path.BaseName().LossyDisplayName();
43 if (relative_path) 43 if (relative_path)
44 *relative_path = FilePath(); 44 *relative_path = FilePath();
45 return true;
45 } 46 }
46 47
47 } // namespace chrome 48 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698