| 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_SYSTEM_MONITOR_MEDIA_STORAGE_UTIL_H_ | 8 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_STORAGE_UTIL_H_ |
| 9 #define CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_STORAGE_UTIL_H_ | 9 #define CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_STORAGE_UTIL_H_ |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 static bool GetDeviceInfoFromPath(const FilePath& path, | 68 static bool GetDeviceInfoFromPath(const FilePath& path, |
| 69 std::string* device_id, | 69 std::string* device_id, |
| 70 string16* device_name, | 70 string16* device_name, |
| 71 FilePath* relative_path); | 71 FilePath* relative_path); |
| 72 | 72 |
| 73 // Get a FilePath for the given |device_id|. If the device isn't a mass | 73 // Get a FilePath for the given |device_id|. If the device isn't a mass |
| 74 // storage type, the FilePath will be empty. This does not check that | 74 // storage type, the FilePath will be empty. This does not check that |
| 75 // the device is connected. | 75 // the device is connected. |
| 76 static FilePath FindDevicePathById(const std::string& device_id); | 76 static FilePath FindDevicePathById(const std::string& device_id); |
| 77 | 77 |
| 78 // Record device information histogram for the given |device_uuid| and |
| 79 // |device_name|. Set |mass_storage| to true, if the current device is a |
| 80 // removable mass storage device else false. |
| 81 static void RecordDeviceInfoHistogram(bool mass_storage, |
| 82 const std::string& device_uuid, |
| 83 const string16& device_name); |
| 84 |
| 78 protected: | 85 protected: |
| 79 typedef bool (*GetDeviceInfoFromPathFunction)(const FilePath& path, | 86 typedef bool (*GetDeviceInfoFromPathFunction)(const FilePath& path, |
| 80 std::string* device_id, | 87 std::string* device_id, |
| 81 string16* device_name, | 88 string16* device_name, |
| 82 FilePath* relative_path); | 89 FilePath* relative_path); |
| 83 | 90 |
| 84 // Set the implementation of GetDeviceInfoFromPath for testing. | 91 // Set the implementation of GetDeviceInfoFromPath for testing. |
| 85 static void SetGetDeviceInfoFromPathFunctionForTesting( | 92 static void SetGetDeviceInfoFromPathFunctionForTesting( |
| 86 GetDeviceInfoFromPathFunction function); | 93 GetDeviceInfoFromPathFunction function); |
| 87 | 94 |
| 88 private: | 95 private: |
| 89 // All methods are static, this class should not be instantiated. | 96 // All methods are static, this class should not be instantiated. |
| 90 MediaStorageUtil(); | 97 MediaStorageUtil(); |
| 91 | 98 |
| 92 DISALLOW_COPY_AND_ASSIGN(MediaStorageUtil); | 99 DISALLOW_COPY_AND_ASSIGN(MediaStorageUtil); |
| 93 }; | 100 }; |
| 94 | 101 |
| 95 } // namespace chrome | 102 } // namespace chrome |
| 96 | 103 |
| 97 #endif // CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_STORAGE_UTIL_H_ | 104 #endif // CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_STORAGE_UTIL_H_ |
| OLD | NEW |