OLD | NEW |
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 // MediaStorageUtil provides information about storage devices attached | 5 // MediaStorageUtil provides information about storage devices attached |
6 // to the computer. | 6 // to the computer. |
7 | 7 |
8 #ifndef CHROME_BROWSER_STORAGE_MONITOR_MEDIA_STORAGE_UTIL_H_ | 8 #ifndef CHROME_BROWSER_STORAGE_MONITOR_MEDIA_STORAGE_UTIL_H_ |
9 #define CHROME_BROWSER_STORAGE_MONITOR_MEDIA_STORAGE_UTIL_H_ | 9 #define CHROME_BROWSER_STORAGE_MONITOR_MEDIA_STORAGE_UTIL_H_ |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 // Removes disconnected devices from |devices| and then calls |done|. | 36 // Removes disconnected devices from |devices| and then calls |done|. |
37 static void FilterAttachedDevices(DeviceIdSet* devices, | 37 static void FilterAttachedDevices(DeviceIdSet* devices, |
38 const base::Closure& done); | 38 const base::Closure& done); |
39 | 39 |
40 // Given |path|, fill in |device_info|, and |relative_path| | 40 // Given |path|, fill in |device_info|, and |relative_path| |
41 // (from the root of the device). | 41 // (from the root of the device). |
42 static bool GetDeviceInfoFromPath(const base::FilePath& path, | 42 static bool GetDeviceInfoFromPath(const base::FilePath& path, |
43 StorageInfo* device_info, | 43 StorageInfo* device_info, |
44 base::FilePath* relative_path); | 44 base::FilePath* relative_path); |
45 | 45 |
| 46 // Get a display name for the given |absolute_path|. |
| 47 // Return empty string if there is no corresponding storage device. |
| 48 static string16 GetGalleryDisplayNameFromPath( |
| 49 const base::FilePath& absolute_path); |
| 50 |
46 // Get a base::FilePath for the given |device_id|. If the device isn't a mass | 51 // Get a base::FilePath for the given |device_id|. If the device isn't a mass |
47 // storage type, the base::FilePath will be empty. This does not check that | 52 // storage type, the base::FilePath will be empty. This does not check that |
48 // the device is connected. | 53 // the device is connected. |
49 static base::FilePath FindDevicePathById(const std::string& device_id); | 54 static base::FilePath FindDevicePathById(const std::string& device_id); |
50 | 55 |
51 // Record device information histogram for the given |device_uuid| and | 56 // Record device information histogram for the given |device_uuid| and |
52 // |device_label|. |mass_storage| indicates whether the current device is a | 57 // |device_label|. |mass_storage| indicates whether the current device is a |
53 // mass storage device, as defined by IsMassStorageDevice(). | 58 // mass storage device, as defined by IsMassStorageDevice(). |
54 static void RecordDeviceInfoHistogram(bool mass_storage, | 59 static void RecordDeviceInfoHistogram(bool mass_storage, |
55 const std::string& device_uuid, | 60 const std::string& device_uuid, |
56 const base::string16& device_label); | 61 const base::string16& device_label); |
57 | 62 |
58 // Returns true if the |id| is both a removable device and also | 63 // Returns true if the |id| is both a removable device and also |
59 // currently attached. | 64 // currently attached. |
60 static bool IsRemovableStorageAttached(const std::string& id); | 65 static bool IsRemovableStorageAttached(const std::string& id); |
61 | 66 |
62 private: | 67 private: |
63 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaStorageUtil); | 68 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaStorageUtil); |
64 }; | 69 }; |
65 | 70 |
66 #endif // CHROME_BROWSER_STORAGE_MONITOR_MEDIA_STORAGE_UTIL_H_ | 71 #endif // CHROME_BROWSER_STORAGE_MONITOR_MEDIA_STORAGE_UTIL_H_ |
OLD | NEW |