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

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

Issue 10911350: Update Windows System Monitor Removable Device Impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | 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 // chrome::MediaStorageUtil implementation. 5 // chrome::MediaStorageUtil implementation.
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 <vector> 9 #include <vector>
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return false; 214 return false;
215 215
216 if (g_test_get_device_info_from_path_function) { 216 if (g_test_get_device_info_from_path_function) {
217 return g_test_get_device_info_from_path_function(path, device_id, 217 return g_test_get_device_info_from_path_function(path, device_id,
218 device_name, 218 device_name,
219 relative_path); 219 relative_path);
220 } 220 }
221 221
222 bool found_device = false; 222 bool found_device = false;
223 base::SystemMonitor::RemovableStorageInfo device_info; 223 base::SystemMonitor::RemovableStorageInfo device_info;
224 #if (defined(OS_LINUX) || defined(OS_MACOSX)) && !defined(OS_CHROMEOS) 224 #if (defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN)) && \
vandebo (ex-Chrome) 2012/09/18 00:51:43 This is the only part that changed.
225 !defined(OS_CHROMEOS)
225 RemovableDeviceNotifications* notifier = 226 RemovableDeviceNotifications* notifier =
226 RemovableDeviceNotifications::GetInstance(); 227 RemovableDeviceNotifications::GetInstance();
227 found_device = notifier->GetDeviceInfoForPath(path, &device_info); 228 found_device = notifier->GetDeviceInfoForPath(path, &device_info);
228 #endif 229 #endif
229 230
230 #if 0 && defined(OS_CHROMEOS) 231 #if 0 && defined(OS_CHROMEOS)
231 if (!found_device) { 232 if (!found_device) {
232 MediaTransferProtocolDeviceObserver* mtp_manager = 233 MediaTransferProtocolDeviceObserver* mtp_manager =
233 MediaTransferProtocolDeviceObserver::GetInstance(); 234 MediaTransferProtocolDeviceObserver::GetInstance();
234 found_device = mtp_manager->GetStorageInfoForPath(path, &device_info); 235 found_device = mtp_manager->GetStorageInfoForPath(path, &device_info);
235 } 236 }
236 #endif 237 #endif
237 238
238 if (found_device && IsRemovableDevice(device_info.device_id)) { 239 if (found_device && IsRemovableDevice(device_info.device_id)) {
239 if (device_id) 240 if (device_id)
240 *device_id = device_info.device_id; 241 *device_id = device_info.device_id;
241 if (device_name) 242 if (device_name)
242 *device_name = device_info.name; 243 *device_name = device_info.name;
243 if (relative_path) { 244 if (relative_path) {
244 *relative_path = FilePath(); 245 *relative_path = FilePath();
245 FilePath mount_point(device_info.location); 246 FilePath mount_point(device_info.location);
246 mount_point.AppendRelativePath(path, relative_path); 247 mount_point.AppendRelativePath(path, relative_path);
247 } 248 }
248 return true; 249 return true;
249 } 250 }
250 251
252 // On Posix systems, there's one root so any absolute path could be valid.
253 #if !defined(OS_POSIX)
254 if (!found_device)
255 return false;
256 #endif
257
251 if (device_id) 258 if (device_id)
252 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); 259 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe());
253 if (device_name) 260 if (device_name)
254 *device_name = path.BaseName().LossyDisplayName(); 261 *device_name = path.BaseName().LossyDisplayName();
255 if (relative_path) 262 if (relative_path)
256 *relative_path = FilePath(); 263 *relative_path = FilePath();
257 return true; 264 return true;
258 } 265 }
259 266
260 // static 267 // static
(...skipping 16 matching lines...) Expand all
277 284
278 // static 285 // static
279 void MediaStorageUtil::SetGetDeviceInfoFromPathFunctionForTesting( 286 void MediaStorageUtil::SetGetDeviceInfoFromPathFunctionForTesting(
280 GetDeviceInfoFromPathFunction function) { 287 GetDeviceInfoFromPathFunction function) {
281 g_test_get_device_info_from_path_function = function; 288 g_test_get_device_info_from_path_function = function;
282 } 289 }
283 290
284 MediaStorageUtil::MediaStorageUtil() {} 291 MediaStorageUtil::MediaStorageUtil() {}
285 292
286 } // namespace chrome 293 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_win.cc ('k') | chrome/browser/system_monitor/removable_device_notifications_window_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698