Chromium Code Reviews| 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 // chrome::MediaStorageUtil provides information about storage devices attached | 5 // chrome::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 18 matching lines...) Expand all Loading... | |
| 29 FIXED_MASS_STORAGE, | 29 FIXED_MASS_STORAGE, |
| 30 // A MTP or PTP device. | 30 // A MTP or PTP device. |
| 31 MTP_OR_PTP, | 31 MTP_OR_PTP, |
| 32 // A Mac ImageCapture device. | 32 // A Mac ImageCapture device. |
| 33 MAC_IMAGE_CAPTURE, | 33 MAC_IMAGE_CAPTURE, |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 typedef std::set<std::string /*device id*/> DeviceIdSet; | 36 typedef std::set<std::string /*device id*/> DeviceIdSet; |
| 37 typedef base::Callback<void(bool)> BoolCallback; | 37 typedef base::Callback<void(bool)> BoolCallback; |
| 38 | 38 |
| 39 | |
| 40 // Check if the file system at the passed mount point looks like a media | |
| 41 // device using the existence of DCIM directory. | |
| 42 // Returns true, if it is a media device otherwise return false. | |
|
Greg Billock
2013/03/06 21:48:27
Can you improve the wording here? Perhaps "Returns
Greg Billock
2013/03/07 20:05:29
Usual practice is to click 'Done' on these when yo
| |
| 43 // Mac OS X behaves similarly, but this is not the only heuristic it uses. | |
| 44 // TODO(vandebo) Try to figure out how Mac OS X decides this, and rename | |
| 45 // if additional OS X heuristic is implemented. | |
| 46 static bool HasDcim(const base::FilePath::StringType& mount_point); | |
| 47 | |
| 48 // Constructs the device product name from |vendor_name| and |model_name|. | |
| 49 static string16 GetFullProductName(const std::string& vendor_name, | |
| 50 const std::string& model_name); | |
| 51 | |
| 52 // Constructs the display name for device from |storage_size_in_bytes| and | |
| 53 // |name|. | |
| 54 static string16 GetDisplayNameForDevice(uint64 storage_size_in_bytes, | |
| 55 const string16& name); | |
| 56 | |
| 39 // Returns a device id given properties of the device. A prefix dependent on | 57 // Returns a device id given properties of the device. A prefix dependent on |
| 40 // |type| is added so |unique_id| need only be unique within the given type. | 58 // |type| is added so |unique_id| need only be unique within the given type. |
| 41 // Returns an empty string if an invalid type is passed in. | 59 // Returns an empty string if an invalid type is passed in. |
| 42 static std::string MakeDeviceId(Type type, const std::string& unique_id); | 60 static std::string MakeDeviceId(Type type, const std::string& unique_id); |
| 43 | 61 |
| 44 // Extracts the device |type| and |unique_id| from |device_id|. Returns false | 62 // Extracts the device |type| and |unique_id| from |device_id|. Returns false |
| 45 // if the device_id isn't properly formatted. | 63 // if the device_id isn't properly formatted. |
| 46 static bool CrackDeviceId(const std::string& device_id, | 64 static bool CrackDeviceId(const std::string& device_id, |
| 47 Type* type, std::string* unique_id); | 65 Type* type, std::string* unique_id); |
| 48 | 66 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 const std::string& device_uuid, | 106 const std::string& device_uuid, |
| 89 const string16& device_name); | 107 const string16& device_name); |
| 90 | 108 |
| 91 private: | 109 private: |
| 92 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaStorageUtil); | 110 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaStorageUtil); |
| 93 }; | 111 }; |
| 94 | 112 |
| 95 } // namespace chrome | 113 } // namespace chrome |
| 96 | 114 |
| 97 #endif // CHROME_BROWSER_STORAGE_MONITOR_MEDIA_STORAGE_UTIL_H_ | 115 #endif // CHROME_BROWSER_STORAGE_MONITOR_MEDIA_STORAGE_UTIL_H_ |
| OLD | NEW |