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

Side by Side Diff: chrome/browser/system_monitor/media_storage_util_win.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 // Windows 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_window_wi n.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 RemovableDeviceNotificationsWindowWin* device_tracker =
21 RemovableDeviceNotificationsLinux::GetInstance(); 21 RemovableDeviceNotificationsWindowWin::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 if (!device_tracker->GetDeviceInfoForPath(path, &device_info))
25 return false;
25 26
26 if (found_device && IsRemovableDevice(device_info.device_id)) { 27 if (IsRemovableDevice(device_info.device_id)) {
27 if (device_id) 28 if (device_id)
28 *device_id = device_info.device_id; 29 *device_id = device_info.device_id;
29 if (device_name) 30 if (device_name)
30 *device_name = device_info.name; 31 *device_name = device_info.name;
31 if (relative_path) { 32 if (relative_path) {
32 *relative_path = FilePath(); 33 *relative_path = FilePath();
33 FilePath mount_point(device_info.location); 34 FilePath mount_point(device_info.location);
34 mount_point.AppendRelativePath(path, relative_path); 35 mount_point.AppendRelativePath(path, relative_path);
35 } 36 }
36 return; 37 return true;
37 } 38 }
38 39
39 if (device_id) 40 if (device_id)
40 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); 41 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe());
41 if (device_name) 42 if (device_name)
42 *device_name = path.BaseName().LossyDisplayName(); 43 *device_name = path.BaseName().LossyDisplayName();
43 if (relative_path) 44 if (relative_path)
44 *relative_path = FilePath(); 45 *relative_path = FilePath();
46 return true;
45 } 47 }
46 48
47 } // namespace chrome 49 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698