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

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

Issue 12147002: Add a receiver interface to RemovableStorageNotifications. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 260 }
261 261
262 // TODO(kmadhusu) Write unit tests for GetDeviceInfoFromPath(). 262 // TODO(kmadhusu) Write unit tests for GetDeviceInfoFromPath().
263 bool MediaStorageUtil::GetDeviceInfoFromPath(const FilePath& path, 263 bool MediaStorageUtil::GetDeviceInfoFromPath(const FilePath& path,
264 std::string* device_id, 264 std::string* device_id,
265 string16* device_name, 265 string16* device_name,
266 FilePath* relative_path) { 266 FilePath* relative_path) {
267 if (!path.IsAbsolute()) 267 if (!path.IsAbsolute())
268 return false; 268 return false;
269 269
270 // TODO(gbillock): Eliminate this in favor of a mock storage notifications.
270 if (g_test_get_device_info_from_path_function) { 271 if (g_test_get_device_info_from_path_function) {
271 return g_test_get_device_info_from_path_function(path, device_id, 272 return g_test_get_device_info_from_path_function(path, device_id,
272 device_name, 273 device_name,
273 relative_path); 274 relative_path);
274 } 275 }
275 276
277 // TODO(gbillock): rationalize this sequence into call(s) to
278 // RemovableStorageNotifications and uniform use/loading of
279 // the display name into StorageInfo, or else delegate name
280 // construction as well.
281
276 bool found_device = false; 282 bool found_device = false;
277 RemovableStorageNotifications::StorageInfo device_info; 283 RemovableStorageNotifications::StorageInfo device_info;
278 #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) 284 #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN)
279 RemovableStorageNotifications* notifier = 285 RemovableStorageNotifications* notifier =
280 RemovableStorageNotifications::GetInstance(); 286 RemovableStorageNotifications::GetInstance();
281 found_device = notifier->GetDeviceInfoForPath(path, &device_info); 287 found_device = notifier->GetDeviceInfoForPath(path, &device_info);
282 #endif 288 #endif
283 289
284 #if defined(OS_LINUX) 290 #if defined(OS_LINUX)
285 if (!found_device) { 291 if (!found_device) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 DEVICE_INFO_BUCKET_BOUNDARY); 386 DEVICE_INFO_BUCKET_BOUNDARY);
381 } 387 }
382 388
383 // static 389 // static
384 void MediaStorageUtil::SetGetDeviceInfoFromPathFunctionForTesting( 390 void MediaStorageUtil::SetGetDeviceInfoFromPathFunctionForTesting(
385 GetDeviceInfoFromPathFunction function) { 391 GetDeviceInfoFromPathFunction function) {
386 g_test_get_device_info_from_path_function = function; 392 g_test_get_device_info_from_path_function = function;
387 } 393 }
388 394
389 } // namespace chrome 395 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698